VGMPlay / in_vgm
Last update: 2023-12-31 (v0.51.1)
Technical discussion about the VGM format, and all the software you need to handle VGM files.
Moderator: Staff
- ValleyBell Offline
- Posts: 4786
- Joined: 2011-12-01, 20:20:07
- Location: Germany
Maybe you should do something such as add a command 0x69 to set up the master volume of a chip, to override the default settings (the default settings might be chosen by the configuration file and/or GD3 tags), although the user can further override it, or depending on the player it might send the commands to those actual chips in which case the master volume will be ignored.
Last edited by zzo38 on 2013-05-05, 8:28:42, edited 1 time in total.
- ValleyBell Offline
- Posts: 4786
- Joined: 2011-12-01, 20:20:07
- Location: Germany
I already added an "extra header" section that allows to adjust the chip volume on a per-vgm basis in v1.70.
I just haven't written tools that write these values yet. (Currently I resize the header with vgm_ptch and overwrite a few bytes using a mini-tool.)
Anyway, I found:
- MAME Namco System 2 "default": YM2151 0.80, C140 0.75 (100%/94%)
- MAME Namco System 2 "default3": YM2151 1.00, C140 0.45 (100%/45%)
- MAME Namco System 2 "metlhawk": YM2151 0.80, C140 1.00 (100%/125%)
- MAME Namco System 21: YM2151 0.30, C140 0.50 (100%/166%)
- M1 Namco System 2: YM2151 0.80, C140 0.40 (100%/50%)
- M1 Namco System 21: YM2151 0.80, C140 0.45 (100%/56%)
This is really a mess, but I think I'll go with default values of YM2151 100% and C140 50% for the next release of VGMPlay.
I just haven't written tools that write these values yet. (Currently I resize the header with vgm_ptch and overwrite a few bytes using a mini-tool.)
Anyway, I found:
- MAME Namco System 2 "default": YM2151 0.80, C140 0.75 (100%/94%)
- MAME Namco System 2 "default3": YM2151 1.00, C140 0.45 (100%/45%)
- MAME Namco System 2 "metlhawk": YM2151 0.80, C140 1.00 (100%/125%)
- MAME Namco System 21: YM2151 0.30, C140 0.50 (100%/166%)
- M1 Namco System 2: YM2151 0.80, C140 0.40 (100%/50%)
- M1 Namco System 21: YM2151 0.80, C140 0.45 (100%/56%)
This is really a mess, but I think I'll go with default values of YM2151 100% and C140 50% for the next release of VGMPlay.
- RichterEX2 Offline
- Posts: 191
- Joined: 2012-03-30, 9:28:37
- Location: Georgia, USA
- ValleyBell Offline
- Posts: 4786
- Joined: 2011-12-01, 20:20:07
- Location: Germany
For FM chips, "interpolation" is quite easy in general. Most of them are written in a way that supports any sample rate while keeping the frequencies correct and the tables with sine-values are quite large (YM2612 has 2^10 values for the 0..1..0 part). So they effectively skip some samples at almost any sample rate and frequency. (i.e. they don't need any interpolation)
For PCM chips it's a bit more difficult. Most of them are written with their native sample rate in mind (32 KHz for the RF5C chips, for example), although it seems that the M1 developers modified them to run at the final output sample rate. (M1 seems to lack a resampler.) If I try to port a few lines from there I should be able to get them running at any sample rate.
The second problem is the actual interpolation. While the interpolation itself shouldn't be too difficult, I need to study how the chips work regarding loop points and other oddities (like banks and address wrap).
tl;dr It'll need lots of time and I have other priorities right now. (like adding MultiPCM support to my tools)
I'm always open for contributions though.
For PCM chips it's a bit more difficult. Most of them are written with their native sample rate in mind (32 KHz for the RF5C chips, for example), although it seems that the M1 developers modified them to run at the final output sample rate. (M1 seems to lack a resampler.) If I try to port a few lines from there I should be able to get them running at any sample rate.
The second problem is the actual interpolation. While the interpolation itself shouldn't be too difficult, I need to study how the chips work regarding loop points and other oddities (like banks and address wrap).
tl;dr It'll need lots of time and I have other priorities right now. (like adding MultiPCM support to my tools)
I'm always open for contributions though.
- dissident93 Offline
- Posts: 204
- Joined: 2012-02-17, 5:54:01
- Location: USA
what chips sound better with a different sample rate? sorry if I missed a list of this somewhere.RichterEX2 wrote:Would it be possible to add interpolation for sample-based chips? I know you can set the Chip sample rate to make the FM in quite a few games sound better. But it doesn't help much with stuff like QSound and a few others.
- RichterEX2 Offline
- Posts: 191
- Joined: 2012-03-30, 9:28:37
- Location: Georgia, USA
- ValleyBell Offline
- Posts: 4786
- Joined: 2011-12-01, 20:20:07
- Location: Germany
Right ... Robocup usually runs the YM2203 at a 20833 Hz sample rate (the chip itself runs at only 1.5 MHz) and the YM3812 outputs with 41666 Hz.
Another good example for chips that sound better at higher sampling rates is the C140 chip. It has a sample rate of 21390 Hz in all Namco System games, which seems to be a lot lower than the native sample rate of most samples it plays.
Another good example for chips that sound better at higher sampling rates is the C140 chip. It has a sample rate of 21390 Hz in all Namco System games, which seems to be a lot lower than the native sample rate of most samples it plays.
- dissident93 Offline
- Posts: 204
- Joined: 2012-02-17, 5:54:01
- Location: USA
- ValleyBell Offline
- Posts: 4786
- Joined: 2011-12-01, 20:20:07
- Location: Germany
"Playback Rate" is the sample rate of the final sound stream (or WAV file, if you use the disk writer). Everything gets resampled to this rate. I recommend 44100 or 48000.
"Resampling Mode" is what is says. I usually use "HQ resampling". The LQ setting is for very slow machines, because it is a bit faster.
"Chip Sample Mode" and "Chip Rate" tell you, which at sample rate the sound chips are emulated. FM chips often use at a fairly high sample rate (> 48 KHz), the sample rate of most PCM chips is a bit lower.
However, emulating FM chips at a non-native sample rate can cause the sounds that use feedback and white noise to sound different.
On PCM chips though, the sound usually can only improve.
I usually have "Chip Sample Mode" set to "highest", which chooses between the native chip sample rate and the one set in the "Chip Rate" field, depending on whether is higher. This usually results in a high sample rate for some PCM chips, but the YM2612 is still emulated with its native sample rate (~55 KHz) and sounds more accurate this way.
(If you set "Chip Rate" to 0, btw, it's supposed to use the "Playback Rate" instead, but due to a bug this only works in VGMPlay right now.)
"Resampling Mode" is what is says. I usually use "HQ resampling". The LQ setting is for very slow machines, because it is a bit faster.
"Chip Sample Mode" and "Chip Rate" tell you, which at sample rate the sound chips are emulated. FM chips often use at a fairly high sample rate (> 48 KHz), the sample rate of most PCM chips is a bit lower.
However, emulating FM chips at a non-native sample rate can cause the sounds that use feedback and white noise to sound different.
On PCM chips though, the sound usually can only improve.
I usually have "Chip Sample Mode" set to "highest", which chooses between the native chip sample rate and the one set in the "Chip Rate" field, depending on whether is higher. This usually results in a high sample rate for some PCM chips, but the YM2612 is still emulated with its native sample rate (~55 KHz) and sounds more accurate this way.
(If you set "Chip Rate" to 0, btw, it's supposed to use the "Playback Rate" instead, but due to a bug this only works in VGMPlay right now.)