Hiya.
This isn't really a MAD question, but it was suggested to me to try this list: I'm trying to implement some support for the output of the 'normalize' package in my mp3 player of choice, but ran into the problem that it doesn't seem that either mpg123 or mpg321 currently support the RVA2 volume adjustment tag in ID3v2.4 tags. So I wrote a little routine in the jukebox wrapper program I'm using ('Tunez') to pull out normalize's backwards-compatible ID3v2.3 "XRVA" tag data.
Practical upshot is that before I call mpg321 I know that I want my file to be played, say, 5 dB louder or 10 dB quieter, but don't know how to translate that into the " -gain " argument's 0-100 scale on mpg123 or mpg321. I could figure this out by trial and error, but was hoping there might be a more definitive conversion. Anyone have any thoughts?
Thanks! - Ert Dredge
On Mar 5, 2004, at 8:43 AM, Ert wrote:
This isn't really a MAD question, but it was suggested to me to try this list: I'm trying to implement some support for the output of the 'normalize' package in my mp3 player of choice, but ran into the problem that it doesn't seem that either mpg123 or mpg321 currently support the RVA2 volume adjustment tag in ID3v2.4 tags. So I wrote a little routine in the jukebox wrapper program I'm using ('Tunez') to pull out normalize's backwards-compatible ID3v2.3 "XRVA" tag data.
Practical upshot is that before I call mpg321 I know that I want my file to be played, say, 5 dB louder or 10 dB quieter, but don't know how to translate that into the " -gain " argument's 0-100 scale on mpg123 or mpg321. I could figure this out by trial and error, but was hoping there might be a more definitive conversion. Anyone have any thoughts?
I don't think Joe Drew (the author of mpg321) subscribes to this list, but my quick check suggests mpg321's "-gain" option simply scales the output samples by the given linear percentage. Although this would seem to imply you couldn't increase the volume (only reduce it), it appears no check is performed on the percentage range, so I think it is possible to pass values >100.
To convert a decibel scalefactor to a linear one, use this formula:
linear = 10^(decibel / 20)
Then of course multiply by 100 and round to get an integer percentage.
Examples: +5 dB => 178% -10 dB => 32%
FWIW, if you're not absolutely tied to mpg123 or mpg321, madplay supports decibel scalefactors directly from the command-line, and furthermore already has native support for RVA2 volume adjustment tags.
Cheers,
Hiya, Rob.
On Mar 5, 2004, at 8:43 AM, Ert wrote:
This isn't really a MAD question, but it was suggested to me to try this list: I'm trying to implement some support for the output of the 'normalize' package in my mp3 player of choice, but ran into the problem that it doesn't seem that either mpg123 or mpg321 currently support the RVA2 volume adjustment tag in ID3v2.4 tags. So I wrote a little routine in the jukebox wrapper program I'm using ('Tunez') to pull out normalize's backwards-compatible ID3v2.3 "XRVA" tag data.
Practical upshot is that before I call mpg321 I know that I want my file to be played, say, 5 dB louder or 10 dB quieter, but don't know how to translate that into the " -gain " argument's 0-100 scale on mpg123 or mpg321. I could figure this out by trial and error, but was hoping there might be a more definitive conversion. Anyone have any thoughts?
On Mar 5, 2004, at 3:08 PM, Rob Leslie wrote:
I don't think Joe Drew (the author of mpg321) subscribes to this list [...]
...same person who pointed me here, in fact. ;-)
[...] but my quick check suggests mpg321's "-gain" option simply scales the output samples by the given linear percentage. Although this would seem to imply you couldn't increase the volume (only reduce it), it appears no check is performed on the percentage range, so I think it is possible to pass values >100.
To convert a decibel scalefactor to a linear one, use this formula:
linear = 10^(decibel / 20)
Then of course multiply by 100 and round to get an integer percentage.
Examples: +5 dB => 178% -10 dB => 32%
Perfect, actually! I can just set 50 as my baseline volume choice, if 100 turns out to be an upper limit, then scale up or down as need be. It'll serve the basic purpose, anyway.
FWIW, if you're not absolutely tied to mpg123 or mpg321, madplay supports decibel scalefactors directly from the command-line, and furthermore already has native support for RVA2 volume adjustment tags.
Hm, perhaps I'll try moving to that. Didn't realize that anyone was reading RVA2 at this point.
Thanks!
- Ert