| 1 |
|
| 2 |
Normalize |
| 3 |
|
| 4 |
This is release 0.7.7 of Normalize, an audio file volume normalizer. |
| 5 |
|
| 6 |
Copyright (c) 1999--2005, Chris Vaill <chrisvaill at gmail> |
| 7 |
|
| 8 |
Normalize is a tool for adjusting the volume of audio files to a |
| 9 |
standard level. This is useful for things like creating mixed CD's and |
| 10 |
mp3 collections, where different recording levels on different albums |
| 11 |
can cause the volume to vary greatly from song to song. |
| 12 |
|
| 13 |
Send bug reports, suggestions, comments to chrisvaill at gmail. |
| 14 |
|
| 15 |
normalize is free software. See the file COPYING for copying |
| 16 |
conditions. |
| 17 |
_________________________________________________________________ |
| 18 |
|
| 19 |
Installation synopsis |
| 20 |
|
| 21 |
1. ./configure options |
| 22 |
2. make |
| 23 |
3. make install |
| 24 |
|
| 25 |
See the file INSTALL for more extensive directions. See the man page, |
| 26 |
normalize.1, for usage. Run "./configure --help" for configure |
| 27 |
options. |
| 28 |
_________________________________________________________________ |
| 29 |
|
| 30 |
Dependencies |
| 31 |
|
| 32 |
These dependencies are optional. Normalize doesn't require any other |
| 33 |
packages to compile and run. |
| 34 |
|
| 35 |
MAD library (http://www.underbit.com/products/mad/) |
| 36 |
|
| 37 |
Normalize will use the MAD MPEG Audio Decoder library if you have it |
| 38 |
(highly recommended). This gives normalize the ability to read mp3 |
| 39 |
files. MAD support in normalize was developed using MAD version |
| 40 |
0.14.2b; earlier versions may not work. |
| 41 |
|
| 42 |
You can run configure with the --without-mad option to turn off mp3 |
| 43 |
read support. |
| 44 |
|
| 45 |
Audiofile library (http://www.68k.org/~michael/audiofile/) |
| 46 |
|
| 47 |
Normalize can use the audiofile library if version 0.2.2 or later is |
| 48 |
available on your system. This gives normalize the ability to read and |
| 49 |
write AIFF, AIFF-C, WAV, NeXT/Sun .snd/.au, Berkeley/IRCAM/CARL, and |
| 50 |
whatever else the audiofile library people decide to implement in the |
| 51 |
future. |
| 52 |
|
| 53 |
Audiofile support is not turned on by default, because the built-in |
| 54 |
WAV support is faster (only because it's specifically tailored for PCM |
| 55 |
WAVs), and because I'm guessing most people only ever need to |
| 56 |
normalize standard PCM WAV and mp3 files. If you only want to use |
| 57 |
normalize on standard PCM WAV and mp3 files, you don't need audiofile. |
| 58 |
If, however, you would like to be able to normalize all the different |
| 59 |
audio file formats that audiofile handles, run configure with the |
| 60 |
--with-audiofile option to turn on audiofile support. |
| 61 |
|
| 62 |
XMMS (http://www.xmms.org/) |
| 63 |
|
| 64 |
If you have xmms installed, the configure system will build the |
| 65 |
xmms-rva plugin, which honors the relative volume adjustment frames |
| 66 |
that normalize adds to ID3 tags. The option --disable-xmms prevents |
| 67 |
the plugin from being built. |
| 68 |
_________________________________________________________________ |
| 69 |
|
| 70 |
Questions and Answers |
| 71 |
|
| 72 |
1. What platforms does normalize work on? |
| 73 |
|
| 74 |
I've tested normalize on GNU/Linux and FreeBSD on x86, Solaris on |
| 75 |
Sparc, and Irix on MIPS. I've heard that it works on GNU/Linux on |
| 76 |
Alpha and on BeOS R5. As far as Windows is concerned, you can compile |
| 77 |
it using the Cygwin toolkit. Question 8, below, contains a brief |
| 78 |
overview of this process. |
| 79 |
|
| 80 |
I've tried to make the code as portable as possible, so I'd appreciate |
| 81 |
hearing whether normalize works on other platforms. |
| 82 |
|
| 83 |
2. What is normalize useful for? |
| 84 |
|
| 85 |
Example 1. Let's say you've got a bunch of wav files containing what |
| 86 |
are, in your estimation, Elvis's greatest hits, collected from various |
| 87 |
albums. You want to encode them as mp3's and add them to an |
| 88 |
established collection, but since they're all from different albums, |
| 89 |
they're all recorded at different volumes from each other and from the |
| 90 |
rest of your mp3 collection. If you've been using normalize on all |
| 91 |
your wav files before you encode them, your collection is normalized |
| 92 |
to the default volume level, and you want these new additions to be at |
| 93 |
the same level. Just run normalize with no options on the files, and |
| 94 |
each will be adjusted to the proper volume level: |
| 95 |
|
| 96 |
normalize "Hound Dog.wav" "Blue Suede Shoes.wav" \ |
| 97 |
"Here Comes Santa Claus.wav" ... |
| 98 |
|
| 99 |
Example 2. Suppose now you've just extracted all the wav files from |
| 100 |
the Gorilla Biscuits album "Start Today," which, you may know, is |
| 101 |
recorded at a particularly low volume. We want to make the whole album |
| 102 |
louder, but individual tracks should stay at the same volume relative |
| 103 |
to each other. For this we use batch mode. Say the files are named |
| 104 |
01.wav to 14.wav, and are in the current directory. We invoke |
| 105 |
normalize in batch mode to preserve the relative volumes, but |
| 106 |
otherwise, everything's the default: |
| 107 |
|
| 108 |
normalize -b *.wav |
| 109 |
|
| 110 |
You can then fire up your mp3 encoder, and the whole album will be |
| 111 |
uniformly louder. |
| 112 |
|
| 113 |
Example 3. Now suppose we want to encode the Converge album "When |
| 114 |
Forever Comes Crashing." This album has one song, "Ten Cents," that is |
| 115 |
really quiet while the rest of the songs have about the same (loud) |
| 116 |
volume. We'll turn up the verbosity so we can see what's going on: |
| 117 |
|
| 118 |
> normalize -bv *.wav |
| 119 |
Computing levels... |
| 120 |
Level for track01.cdda.wav: -9.3980dBFS (0.0000dBFS peak) |
| 121 |
Level for track02.cdda.wav: -9.2464dBFS (-0.1538dBFS peak) |
| 122 |
Level for track03.cdda.wav: -8.6308dBFS (-0.2520dBFS peak) |
| 123 |
Level for track04.cdda.wav: -8.7390dBFS (0.0000dBFS peak) |
| 124 |
Level for track05.cdda.wav: -8.1000dBFS (-0.0003dBFS peak) |
| 125 |
Level for track06.cdda.wav: -8.2215dBFS (-0.1754dBFS peak) |
| 126 |
Level for track07.cdda.wav: -8.9346dBFS (-0.1765dBFS peak) |
| 127 |
Level for track08.cdda.wav: -13.6175dBFS (-0.4552dBFS peak) |
| 128 |
Level for track09.cdda.wav: -9.0107dBFS (-0.1778dBFS peak) |
| 129 |
Level for track10.cdda.wav: -8.1824dBFS (-0.4519dBFS peak) |
| 130 |
Level for track11.cdda.wav: -8.5700dBFS (-0.1778dBFS peak) |
| 131 |
Standard deviation is 1.47 dB |
| 132 |
Throwing out level of -13.6175dBFS (different by 4.58dB) |
| 133 |
Average level: -8.6929dBFS |
| 134 |
Applying adjustment of -3.35dB... |
| 135 |
|
| 136 |
The volume of "Ten Cents," which is track 8, is 4.58 decibels off the |
| 137 |
average, which, given a standard deviation of 1.47 decibels, makes it |
| 138 |
a statistical aberration (which I've defined as anything off by more |
| 139 |
that twice the standard deviation, but you can set a constant decibel |
| 140 |
threshold with the -t option). Therefore, it isn't counted in the |
| 141 |
average, and the adjustment applied to the album isn't thrown off |
| 142 |
because of one song. Although the aberrant song's volume is not |
| 143 |
counted in the average, it is adjusted along with the rest of the |
| 144 |
files. |
| 145 |
|
| 146 |
Example 4. Finally, say you want to make a mixed CD of 80's songs for |
| 147 |
your mom or something. You won't allow any 80's songs to taint your |
| 148 |
hallowed mp3 collection, so the absolute volumes of these tracks don't |
| 149 |
matter, as long as they're all about the same, so mom doesn't have to |
| 150 |
keep adjusting the volume. For this, use the mix mode option, |
| 151 |
|
| 152 |
normalize -m *.wav |
| 153 |
|
| 154 |
and each track will be adjusted to the average level of all the |
| 155 |
tracks. |
| 156 |
|
| 157 |
3. How does normalize work? |
| 158 |
|
| 159 |
A little background on how normalize computes the volume of a wav |
| 160 |
file, in case you want to know just how your files are being munged: |
| 161 |
|
| 162 |
The volumes calculated are RMS amplitudes, which correspond (roughly) |
| 163 |
to perceived volume. Taking the RMS amplitude of an entire file would |
| 164 |
not give us quite the measure we want, though, because a quiet song |
| 165 |
punctuated by short loud parts would average out to a quiet song, and |
| 166 |
the adjustment we would compute would make the loud parts excessively |
| 167 |
loud. |
| 168 |
|
| 169 |
What we want is to consider the maximum volume of the file, and |
| 170 |
normalize according to that. We break up the signal into 100 chunks |
| 171 |
per second, and get the signal power of each chunk, in order to get an |
| 172 |
estimation of "instantaneous power" over time. This "instantaneous |
| 173 |
power" signal varies too much to get a good measure of the original |
| 174 |
signal's maximum sustained power, so we run a smoothing algorithm over |
| 175 |
the power signal (specifically, a mean filter with a window width of |
| 176 |
100 elements). The maximum point of the smoothed power signal turns |
| 177 |
out to be a good measure of the maximum sustained power of the file. |
| 178 |
We can then take the square root of the power to get maximum sustained |
| 179 |
RMS amplitude. |
| 180 |
|
| 181 |
As for the default target amplitude of 0.25 (-12dBFS), I've found that |
| 182 |
it's pretty close to the level of most of my albums already, but not |
| 183 |
so high as to cause a lot of limiting on quieter albums. You may want |
| 184 |
to choose a different target amplitude, depending on your music |
| 185 |
collection (just make sure you normalize everything to the same |
| 186 |
amplitude if you want it to all be the same volume!). |
| 187 |
|
| 188 |
Regarding clipping: since version 0.6, a limiter is employed to |
| 189 |
eliminate clipping. The limiter is on by default; you don't have to do |
| 190 |
anything to use it. The 0.5 series had a -c option to turn on |
| 191 |
limiting, but that limiter caused problems with inexact volume |
| 192 |
adjustment. The new limiter doesn't have this problem, and the -c |
| 193 |
option is considered deprecated (it will be removed in version 1.0). |
| 194 |
|
| 195 |
Please note that I'm not a recording engineer or an electrical |
| 196 |
engineer, so my signal processing theory may be off. I'd be glad to |
| 197 |
hear from any signal processing wizards if I've made faulty |
| 198 |
assumptions regarding signal power, perceived volume, or any of that |
| 199 |
fun signal theory stuff. |
| 200 |
|
| 201 |
4. Why don't you normalize using peak levels instead of RMS amplitude? |
| 202 |
|
| 203 |
Well, in early (unreleased) versions, this is how it worked. I found |
| 204 |
that this just didn't work well. The volume that your ear hears |
| 205 |
corresponds more closely with average RMS amplitude level than with |
| 206 |
peak level. Therefore, making the RMS amplitude of two files equal |
| 207 |
makes their perceived volume equal. (Approximately equal, anyway: |
| 208 |
certain frequencies sound louder at the same amplitude because the ear |
| 209 |
is just more sensitive to those frequencies. I may try to take this |
| 210 |
into account in a future version, but that opens up a whole new can of |
| 211 |
worms.) |
| 212 |
|
| 213 |
"Normalizing" by peak level generally makes files with small dynamic |
| 214 |
range very loud and does nothing to files with large dynamic ranges. |
| 215 |
There's not really any normalization being done, it's more of a |
| 216 |
histogram expansion. That said, since version 0.5, you can use the |
| 217 |
--peak option to do this in normalize if you're sure it's what you |
| 218 |
really want to do. |
| 219 |
|
| 220 |
5. Can normalize operate directly on mp3 files? |
| 221 |
|
| 222 |
Version 0.7 and up can operate directly on MPEG audio files. An mp3 |
| 223 |
file is decoded (using Robert Leslie's MAD library) and analyzed on |
| 224 |
the fly, without the need for large temporary WAV files. The mp3 file |
| 225 |
is then "adjusted" by setting its relative volume adjustment |
| 226 |
information (technically, an "RVA2" frame is set in its ID3v2 tag). |
| 227 |
The advantage of this method is that the audio data doesn't need to be |
| 228 |
touched, and you don't incur the cost of re-encoding. The disadvantage |
| 229 |
is that your mp3 player needs to read and use relative volume |
| 230 |
adjustment ID3 frames. The normalize distribution now includes a |
| 231 |
plugin for xmms that honors volume adjustment frames. If you use an |
| 232 |
mp3 player other than xmms, you'll have to bug the author to support |
| 233 |
RVA2 frames in ID3 tags. |
| 234 |
|
| 235 |
If you'd rather change the volume of the mp3 audio data itself, you |
| 236 |
still have to decode to WAV, normalize the WAV, and re-encode. A |
| 237 |
script, normalize-mp3, is included in the normalize distribution to do |
| 238 |
this for you. |
| 239 |
|
| 240 |
6. Can normalize operate on ogg vorbis files? |
| 241 |
|
| 242 |
Version 0.8 will at least be able to read vorbis audio files. |
| 243 |
Adjusting is harder, though: the problem is that, unlike with ID3, as |
| 244 |
far as I know there's no standardized volume adjustment tag for ogg. I |
| 245 |
could just use, say, "VOLUME_ADJUST=X.XXdB" as an ogg comment, but |
| 246 |
there would be no reason for players to support it. |
| 247 |
|
| 248 |
It may be possible to twiddle the vorbis data itself to alter the |
| 249 |
volume in a lossless way. I'm looking into this, but it would be a big |
| 250 |
undertaking, not something that would be finished anytime soon. |
| 251 |
|
| 252 |
The current situation is that you have to decode to WAV, normalize the |
| 253 |
WAV, and re-encode. The normalize-ogg script is included in the |
| 254 |
normalize distribution to do this for you. |
| 255 |
|
| 256 |
7. How do I normalize a whole tree of files recursively? |
| 257 |
|
| 258 |
The "unix way" to do this is to use find: |
| 259 |
|
| 260 |
find . -type d -exec sh -c "normalize -b \"{}\"/*.mp3" \; |
| 261 |
|
| 262 |
will go directory by directory, running normalize -b on all mp3 files |
| 263 |
in each. If you don't want batch mode, just: |
| 264 |
|
| 265 |
find . -name \*.mp3 -exec normalize {} \; |
| 266 |
|
| 267 |
will run normalize on each mp3 file separately. If you want to run |
| 268 |
normalize in batch or mix mode on all files in the directory tree, |
| 269 |
use: |
| 270 |
|
| 271 |
find . -name \*.mp3 -print0 | xargs -0 normalize -b |
| 272 |
|
| 273 |
A built-in recurse option has been a very popular request, so I'm |
| 274 |
adding support for it in version 0.8. |
| 275 |
|
| 276 |
8. How do I use normalize in Windows? |
| 277 |
|
| 278 |
"I click on INSTALL but nothing happens. What's wrong?" Okay, here's |
| 279 |
the deal: normalize is free software, written for free operating |
| 280 |
systems such as Linux and FreeBSD. These happen to be unix-style |
| 281 |
operating systems, so normalize generally works on other non-free |
| 282 |
flavors of unix as well. Unlike Windows software, unix software such |
| 283 |
as normalize is meant to run on many different operating systems on |
| 284 |
many different architectures, so usually it comes in source code form |
| 285 |
and you have to compile it for your particular setup. If you are |
| 286 |
running some form of unix, normalize should compile right out of the |
| 287 |
box (let me know if it doesn't!). For other operating systems, such as |
| 288 |
Amiga, BeOS, OS/2, or Windows, you may have to jump through some hoops |
| 289 |
to get it to compile. |
| 290 |
|
| 291 |
A discussion of compiling unix software for Windows is way beyond the |
| 292 |
scope of this FAQ, but here's a quick rundown: |
| 293 |
|
| 294 |
1. You first need the Cygwin toolkit. After installing, start up a |
| 295 |
cygwin bash shell. |
| 296 |
2. Go to the directory where you unzipped the normalize archive -- it |
| 297 |
would be named something like normalize-x.y.z. |
| 298 |
3. Type "./configure", then "make", then "make install" |
| 299 |
4. If there were no errors, you can run normalize by typing |
| 300 |
"normalize" at the prompt. Normalize is a command-line utility, so |
| 301 |
you have to pass it command line options. Run "normalize --help" |
| 302 |
for a synopsis. |
| 303 |
_________________________________________________________________ |
| 304 |
|
| 305 |
Copyright (c) 1999--2005, Chris Vaill <chrisvaill at gmail> |
| 306 |
|
| 307 |
Permission is granted to copy, distribute, and/or modify this document |
| 308 |
under the terms of the GNU General Public License as published by the |
| 309 |
Free Software Foundation; either version 2 of the License, or (at your |
| 310 |
option) any later version. |