rawrms: estimate loudness of raw pcm data Posted August 10, 2003
rawrms estimates how loud its input (raw pcm data) will sound.
This is useful for automatically adjusting the volume while playing audio files.
To install:
cd /usr/local/src
fetch http://tomclegg.net/software/rawrms-0.1.tar.gz
tar xzf rawrms-0.1.tar.gz
cd rawrms-0.1
make install
Example:
$ mpg123 -q -s example.mp3 | rawrms
5251
mpg123-auto (included) uses rawrms to quickly estimate the volume of a long track by decoding only some of the frames. Then it uses mpg123 to play the track with an appropriate volume adjustment. Example:
$ mpg123-auto example.mp3
mpg123-auto attempts to save the resulting volume adjustments in a folder called scale , so that next time it plays the same MP3 file, it will not have to decode it again. If the current working directory does not contain a file called scale , this feature is effectively disabled.
$ mkdir scale
$ mpg123-auto example.mp3
(long pause before any sound comes out)
$ mpg123-auto example.mp3
(starts playing immediately)
If the CACHEONLY environment variable is set to a non-empty value, then mpg123-auto quits after saving the volume adjustment in the scale folder. This is useful for calculating the volume adjustments ahead of time for a collection of MP3 files.
$ mkdir scale
$ CACHEONLY=1 find /mp3 -type f -name \*.mp3 -print -exec mpg123-auto {} \;
Bugs
- Requires mp3cat
- Ignores all arguments except the last one, rather than passing them through to
mpg123
|