HydrogenAudio

Hydrogenaudio Forum => General Audio => Topic started by: terataz on 2012-12-12 20:32:21

Title: Contant Peak, Constant RMS
Post by: terataz on 2012-12-12 20:32:21
Hi, we are trying to set a default standard for the volume of the audio files we are working on.
We are looking for a tool that, given a bunch of mp3 files, will be able to normalize them at a given db.

For example : 0db for Peak levels and -9db for RMS.

Ideally, we'd love to use sox as we can chain it with other effects we're using without the need to convert multiple time the file from mp3 to wav and back.

We tried sox gain -n , sox gain -ne, sox gain -nb, sox loudness but none of them keep a constant RMS without varying the Peak level as well.
Any help appreciated.
Thanks
Title: Contant Peak, Constant RMS
Post by: splice on 2012-12-13 00:32:49
Assuming that you want the files to be reproduced at what a listener would perceive to be a "standard volume", I suggest you implement "ReplayGain". This adds a tag to the MP3 file which causes any ReplayGain-aware MP3 decoder to adjust the perceived volume on playback to a set level. For non-aware decoders, there is a tool (MP3Gain) which goes through an MP3 file and adjusts the gain on each frame to match the ReplayGain value.
Title: Contant Peak, Constant RMS
Post by: mjb2006 on 2012-12-13 02:38:47
As above. Why do you need exactly peak 0 and RMS -9 dBFS? If you are going for consistent perceived loudness, this problem was solved a while ago with ReplayGain.

I note you've asked about this at least twice before:
http://www.hydrogenaudio.org/forums/index....showtopic=72664 (http://www.hydrogenaudio.org/forums/index.php?showtopic=72664)
http://www.hydrogenaudio.org/forums/index....showtopic=93180 (http://www.hydrogenaudio.org/forums/index.php?showtopic=93180)
Title: Contant Peak, Constant RMS
Post by: AndyH-ha on 2012-12-13 05:23:03
Peak and RMS are not tied to one another. Making them so would probably lead to some peculiar results -- not that modern mastering doesn't often produce rather peculiar results. I don't use things like ReplayGain, so I could be quite wrong, but I did not think such tools applied compression, which is a rather more complicated process than adjusting either peak or RMS. The results you aim for will require a multi-band compressor, at the least, or an RMS adjustor plus a ruthlessly used hard limiter.

On the other hand, from the comments I've seen is this forum and other places, most modern pop, rock, and other such genres that one finds widely played on radio, etc. frequently has well less than 9dB total dynamic range to begin with, let alone 9dB between RMS and peak. Of course if you are recording your own material, or getting 50 year old stuff from LP, that is a different matter.
Title: Contant Peak, Constant RMS
Post by: splice on 2012-12-13 06:40:45
It looks like Francesco is building playlists for use in "muzak" type situations - restaurants, bars etc. His media options appear to include MP3 players, audio-only DVDs that can be played on a standard DVD player without a visual display, and music servers that can be updated automatically over the Internet. He wants to:
- Automatically classify tracks using parameters such as "tempo, pitch, loudness, signature, beats, key and so on".
- Arrange the tracks into playlists by genre etc using the above classifications.
- Use MP3 or AAC format to make the track files as small as practical.
- Process the tracks to a consistent loudness for each genre.
- Store the playlists in a format that can be accessed with a minimal user interface (a few buttons).
Title: Contant Peak, Constant RMS
Post by: terataz on 2012-12-13 17:18:02
It looks like Francesco is building playlists for use in "muzak" type situations - restaurants, bars etc. His media options appear to include MP3 players, audio-only DVDs that can be played on a standard DVD player without a visual display, and music servers that can be updated automatically over the Internet. He wants to:
- Automatically classify tracks using parameters such as "tempo, pitch, loudness, signature, beats, key and so on".
- Arrange the tracks into playlists by genre etc using the above classifications.
- Use MP3 or AAC format to make the track files as small as practical.
- Process the tracks to a consistent loudness for each genre.
- Store the playlists in a format that can be accessed with a minimal user interface (a few buttons).


Splice,
not sure how you did it, but you're quite right on all you've said

Thanks all for your replies.

We did have a good go with ReplayGain via mp3gain, but could not find a consistent way to normalize files with it.
Instead, it seems mp3gain does a batch analisys and make some sort of average.
When you change the audio batch, the average change, making the volume inconsistent between batches.
What we look for instead is a sort of standard that we and our clients can refer to.

For reference only, this is how we managed to achieve our goal.
It is not the most elegant solution, but it seems to work.

Per each single file:
1) Peak normalization to 0db using sox
2) normalize-audio -a -9dBFS for a standard RMS of around -9db
3) sox vol 0db 0.01 for a soft limiter to prevent clipping


Title: Contant Peak, Constant RMS
Post by: DVDdoug on 2012-12-13 18:15:40
If you boost the level by 3dB, the average and peak both increase by 3dB (assuming no limiting or clipping.)  The ratio* between the peak and average is constant unless you do non-linear processing (clipping, limiting, compression).

Quote
1) Peak normalization to 0db using sox
2) normalize-audio -a -9dBFS for a standard RMS of around -9db
You can skip step 1.  Peak Normalization is a volume adjustment, and adjusting to
-9dB is another volume adjustment.

Quote
3) sox vol 0db 0.01 for a soft limiter to prevent clipping
After adjusting to -9dB RMS, you'll have lots of "signal" above 0dB and several dB of limiting, which will probably cause some files to sound distorted.  Soft clipping isn't as noticeable as hard-clipping, but it's still distortion.

Quote
Instead, it seems mp3gain does a batch analisys and make some sort of average.
When you change the audio batch, the average change, making the volume inconsistent between batches.
The "Album Gain" is a batch adjustment to keep the same relative levels throughout the album....  Loud songs remain loud, and quiet songs remain quiet the way the album was intended.  If you choose "Track Gain", the songs are processed independently.

ReplayGain works great for me!, but nothing is perfect!  Two humans might not even agree when two different songs are equally loud, especially if a song has loud-parts and quiet parts.    Dynamic compression and limiting can help a lot, but they destroy the dynamic contrast in the music (if over-done).   



* Decibels are logarithmic, so the dB is a constant number.    If the peaks are twice as loud as the average, that's a 6dB difference and when you increase/decrease the volume (linearly), the ratio remains 2:1 and difference remains 6dB.
Title: Contant Peak, Constant RMS
Post by: splice on 2012-12-13 21:09:07
...
Splice,
not sure how you did it, but you're quite right on all you've said  ...


I just did "Search for all posts by terataz" and read them. Then I thought to myself, "Where have I heard music like this?"