Bulk Normalize AIFF Files

Am running Mac OS 11.6.6 Big Sur and Audacity 2.4.2.

I want to bulk normalize a bunch of AIFF files.

I have been opening them in Audacity and running a simple script.

01 Select All
02 Normalize, Apply Gain = 1, Peak Level -5, RemoveDCOffset=1, StereoIndependent=0
03 -End-

I have no idea if those settings are appropriate, but it seems to work OK.

I then have to Export Audio for each file, then close the file and tell Audacity not to save. This is time consuming and tedious.

So I tried Apply Macro / Palette, selected my macro, selected files in a folder. Audacity seems to run, but the volume / amplitude appears to not change (in the image, briefly before it disappears) and the files are apparently not saved as the last modified date does not change. If the files are changed, I have no idea where the saved files are.

Any suggestions on what I should do differently?

BTW, if I do this on a MP3 file, I assume Audacity extracts the MP3 to a lossless format, adjusts, and exports back to MP3. Every time this is done, the MP3 is supposed to degrade a bit, so I am planning on applying this only to my lossless AIFF files prior to then converting them to MP3. Does this make sense?

I never use macros…

I assume you already know that regular (peak) normalization doesn’t match “loudness”.

-5dB seems low, but of course that’s up to you. Most commercial recordings are 0dB normalized (AKA “maximized”).


BTW, if I do this on a MP3 file, I assume Audacity extracts the MP3 to a lossless format, adjusts, and exports back to MP3. Every time this is done, the MP3 is supposed to degrade a bit

That’s correct. When you re-export you are going through another generation of lossy compression and some “damage” does accumulate. BTW: AAC (=MP4 =M4A) is also lossy but it’s immune to accumulated degradation.

There are a couple of programs that can do limited MP3 editing without decoding. But without decoding, MP3 can only be amplified/attenuated in 1.5dB steps. Which means you can usually get within 3/4dB of your target.

“-5 dB” may be a bit low (depending on your needs), but other than that it looks good to me. I generally normalize to -1 dB for music that I intend for listening.


As you’ve worked out, applying to “files” is the way to go, but you will need to add one of the “Export” commands at the end of the script. For example, if you want to export as WAV, use the “Export as WAV” (“ExportWav:”) command. The WAV file will then be exported to a “macro output” folder according to your Preference settings (see: Directories Preferences - Audacity Manual)

Thanks for the comments. I initially tried 0 dB in these AIFF lossless files. That seemed to work fine. But when converting to MP3 and reimporting them into Audacity to view them, some files displayed quite a bit of overload / clipping (those red vertical lines in the waveform) that were not in the AIFF. I thought I read somewhere that getting clipping in MP3 when the original did not have clipping is not uncommon. I have tried -2 dB and am now just trying -5 dB.

I was guessing -5 dB might be a good compromise as I am not going to be able to normalize all of my songs, so this will place these in the middle. Plus, hearing the difference of 3 dB or so is fairly obvious when played side-by-side, but not so in a noisy car. Still experimenting thought.

I appreciate the comment that I need a save command. I will be importing these into Apple Music. I think it cannot handle WAV. There is not a specific save for AIFF, but if I select ‘Export Audio’ it seems to do so back into AIFF. So I will try that command.

During the rapid running of this Macro, I never saw the display change, so it looked to me that Normalize did not occur.

“I assume you already know that regular (peak) normalization doesn’t match “loudness”.”

Yes, and no. I realize there are things like compression that makes a file sound louder by raising the overall sound level without necessarily affecting the peaks. But I don’t want to lose the dynamic range. There is also Amplify and Loudness Normalization. I am still studying and trying to understand the advantages / disadvantages of each. Loudness Normalization seems to introduce a compression to the music which I would like to avoid. Might work great for speech, but not desirable for music (radio stations take note!).

“The WAV file will then be exported to a “macro output” folder according to your Preference settings (see: https://manual.audacityteam.org/man/dir … ences.html)”

I don’t see that option in the Mac version.

The red “clip lines” can look worse than it really is. If the waveform just touches 0 dB, then “View clipping” will show a red clip line, even though it may not actually be clipped. If multiple samples in a sequence show red lines, then there is almost certainly be clipping.

Yes it’s true that MP3s may have peaks a bit higher (or lower) than the original audio, but allowing 2 dB headroom is usually sufficient - 3dB if you want to be more cautious.


If that’s true, it’s surprising. Virtually everything supports WAV, though I know that both Apple and Microsoft like to convert to a compressed format by default. Unless you’re short of disk space, I’d suggest that you check to see if WAV is supported - I’d expect that WAV would be supported but converted to a compressed format by default.

Apple prefer AIFF to WAV because AIFF is Apple’s version of “RIFF PCM”, whereas Microsoft went for the WAV flavour of “RIFF PCM”. WAV is far more common as the de facto audio file format outside of Apple’s iEmpire™.


Make a test file that has a very low level, so that the change will be obvious if it is working correctly.


Audacity’s “Amplify”, “Normalize” and “Loudness Normalization” all work in pretty much the same way. None of them affect the dynamic range (so long as you don’t clip). The difference is in how they work out how much to amplify.

Amplify: When run manually, the default amplification is to amplify up to a peak level of 0 dB. Other amplification amounts can be set through the interface.
When used in a macro, the amplification amount is a fixed ratio. For example, +6.02 dB = a ratio of 1:2.0

Normalize: This works out how much to amplify so that each track reaches a specified peak level. This tends to be very useful for macros as you can batch process multiple file to a specified amount under 0 dB.

Loudness Normalization: This attempts to work out how much to amplify according to how “loud” it sounds. This uses an algorithm to calculate / estimate the perceived loudness. Be careful with this in batch files - it provides no protection against clipping. If you set the loudness too high, then the export could be clipped.

You are using an old version of Audacity. The current version (Audacity 3.1.3) has this feature.
You can check which version of Audacity you are using by looking in: “Audacity menu > About Audacity”

initially tried 0 dB in these AIFF lossless files. That seemed to work fine. But when converting to MP3 and reimporting them into Audacity to view them, some files displayed quite a bit of overload / clipping (those red vertical lines in the waveform) that were not in the AIFF. I thought I read somewhere that getting clipping in MP3 when the original did not have clipping is not uncommon. I have tried -2 dB and am now just trying -5 dB.

Right… One of the side effects of MP3 is that the wave shape changes making some peaks higher and some lower. It’s unpredictable but it seems to be worse when the file is “artificially” dynamically compressed or limited.*

These short-term peaks don’t change the perceived loudness or the perceived dynamics but some people use the [u]crest factor[/u] to measure dynamics so the MP3 will measure “better”. The same thing happens with vinyl leading people to claim the vinyl is less compressed than the CD. Sometimes it is less compressed and sometimes it’s just an artifact of the record cutting & playback process.

“I assume you already know that regular (peak) normalization doesn’t match “loudness”.”

Yes, and no. I realize there are things like compression that makes a file sound louder by raising the overall sound level without necessarily affecting the peaks. But I don’t want to lose the dynamic range. There is also Amplify and Loudness Normalization. I am still studying and trying to understand the advantages / disadvantages of each.

Loudness Normalization seems to introduce a compression to the music which

No, Audacity’s Loudness Normalization is a linear adjustment, just like the Amplify or Normalize effect. Some other loudness matching/normalization (like radio stations use) may include compression and/or limiting.

So here’s the BIG challenge - Some quiet sounding recordings are already 0dB normalized. (Typically these are the most dynamic recordings.) That means it can’t be boosted to match your loud recordings (without clipping) so if you want to match volumes, the loud-sounding recordings have to be reduced.

Related to that is you can’t predict if a particular Loudness Normalization target will push the peaks into clipping. Unfortunately, Audacity doesn’t have a built-in tool simply measuring loudness (there are 3rd-party plug-ins) so that’s trial-and-error. Or, if you do end-up with clipping you can compromise and just normalize or amplify for 0dB peaks. (If Audacity shows red as a result of a volume adjustment, it’s not actually clipped yet and you can “safely” reduce the volume.)

There loudness matching tools such as ReplayGain,** WaveGain, and MP3 Gain. They use a default target loudness that ends-up reducing many (or most) tracks. It seems to “typically” be a -6db adjustment on “loud tracks” but of course it varies.

Even with that low target level, there will be some quiet-sounding tracks that can’t be volume matched without clipping. All 3 of those tools have an option to automatically prevent clipping so in cases where the target can be reached without clipping, the volume sill still be a little lower than the other tracks (but it will be better-matched because the loud tracks have been reduced and maybe the quiet track can be boosted to some extent).



\

  • Another interesting thing - If the uncompressed data wasn’t clipped, the MP3 isn’t clipped. It just goes over 0dB, and MP3 can go over 0dB without clipping so Audacity shows red for potential clipping. But, you Will clip your DAC if you play it at “full digital volume”. Possibly not if you are using the Windows volume control, or other control to reduce the volume before it hits the DAC.

As far as I know, that slight clipping isn’t audible. I’ve never noticed it and I’ve never heard of a case where someone was hearing compression artifacts and reducing the volume before compression removed the artifact. We already know that MP3 is “imperfect” so it doesn’t bother me if it’s “more imperfect” as long as I’m not hearing a difference.



** ReplayGain is built-into some player software. It doesn’t change the audio data in the file. You pre-scan the file for loudness and it adds a “tag” to the file and the playback volume is adjusted up or down at playback time.

WaveGain and MP3Gain make “permanent” changes to the file so they work on any player or player software. MP3Gain uses that “trick” of adjusting the volume in 1.5dB increments without decompressing & recompressing.

These programs use a confusing (positive) dB SPL target (89dB?) which somehow correlates to a digital (negative) dB level. The reason for that is the equal-loudness curves. And the loudness algorithm (which is older) is different than (the newer) LUFS loudness. So if you run WaveGain, the results won’t exactly-match Audacity’s loudness normalization.

I checked. You are right.

“Tunes 11 can currently read, write and convert between MP3, AIFF, WAV, MPEG-4, AAC and Apple Lossless (.m4a).”

https://discussions.apple.com/thread/5078781

I do prefer to stay with AIFF because that is what I use (regardless of whether Microsoft or Apple ‘empire’) and apparently Audacity can export to that. It just does not show up on the menu. If I select ‘Export Audio’ it works just fine.

Apple’s version is called “Sound Check”. It is supported by many Apple products, but may be buried deep in the preferences / settings.

Thank you for that. Interesting is that I just updated Audacity prior to starting this process a couple of months ago. I now see 3.1.3.

Thank you for this information. I think it confirms my choice to stay with ‘Normalize’.

Audacity 3.1.3 was released last December. The latest official release is always available from the Audacity website: Audacity ® | Downloads

All very useful information. Thank you.

This is being played back through two different places:

  • Music (Apple App) on my desktop:
  • Through external speakers wired to the computer.
  • Through airplay (non-compressed, via WiFi) to a room surround sound receiver.
  • Through bluetooth (compressed).
  • Music (Apple App) on my phone to the car system via CarPlay or bluetooth.

In none of those situations is there an effective ‘ReplayGain’ to take care of amplitude or perceived loudness differences. Both cars claim to have some sort of volume gain leveler, but neither are particularly effective. I end up ‘driving’ the sound as much as driving the car.

Given that most of my files are compressed MP3’s, I am not going to try to equalize them. I am only going to work with the lossless files I have prior to compressing them.

Music app on the computer does have a ‘volume adjust’ and equalizer for each file. But in my limited experiments, it affect playback while on the computer, but not when sync’ed to my phone.