Normalize a Directory of mp3s

By  on  

Back in the early days of Napster, Kazaa, eMule, and other file sharing networks, I would download as many apps, movies, game, and movies as possible.  My illegal downloading was out of control; I would get DMCA notices from my ISP for apps and games I had no intention of using -- I would simply download them because I could.  And when someone finally cracked the holy grail, Half-Life 2, I was in heaven!

Getting apps and games to work required keygens and cracks, which was a fun challenge, but one annoyance was that pirated mp3 volume always seemed to be different.  One mp3 would be quiet, the next would super loud, and so on, so each song would require me to man the volume controls like a DJ.  Today I download mp3s from YouTube and still the volume is different from source to source, thus I'm still needing to adjust volume while I drive or code.  Ugh!

Since the same volume problem exists today from my YouTube downloads, I searched for command line utility to equalize mp3 volume and the winner was mp3gain.  With mp3gain you can equalize a directory of mp3s from command line with ease!

# From the mp3s' containing directory
mp3gain -r *.mp3

# RESULT: 
# 2Pac - Dear Mama.mp3
# Applying mp3 gain change of -4 to 2Pac - Dear Mama.mp3...
# Orestes - A Perfect Circle.mp3
# Applying mp3 gain change of -4 to Orestes - A Perfect Circle.mp3...
# Adele - Rolling in the Deep.mp3
# Applying mp3 gain change of -4 to Adele - Rolling in the Deep.mp3...

mp3gain will analyze all mp3s for volume, create a baseline, and equalize the volume in all mp3 files.

If you're hosting a party or simply don't want to be a slave to the volume knob, check out mp3gain.  Of course we shouldn't whine about free music but hey -- we're tech savvy and know how to get what we want.  The audio volume level issue isn't one that will go away any time soon so keep mp3gain in your toolbox!

Recent Features

  • By
    Responsive Images: The Ultimate Guide

    Chances are that any Web designers using our Ghostlab browser testing app, which allows seamless testing across all devices simultaneously, will have worked with responsive design in some shape or form. And as today's websites and devices become ever more varied, a plethora of responsive images...

  • By
    Responsive and Infinitely Scalable JS Animations

    Back in late 2012 it was not easy to find open source projects using requestAnimationFrame() - this is the hook that allows Javascript code to synchronize with a web browser's native paint loop. Animations using this method can run at 60 fps and deliver fantastic...

Incredible Demos

  • By
    Create a Simple News Scroller Using MooTools, Part I:  The Basics

    News scroller have been around forever on the internet. Why? Because they're usually classy and effective. Over the next few weeks, we'll be taking a simple scroller and making it into a flexible, portable class. We have to crawl before we...

  • By
    MooTools Overlay Plugin

    Overlays have become a big part of modern websites; we can probably attribute that to the numerous lightboxes that use them. I've found a ton of overlay code snippets out there but none of them satisfy my taste in code. Many of them are...

Discussion

  1. Unfortunately normalization (optimizing the peak signal level) has no consistent relationship to the overall loudness of a track. Peak optimization and perceived loudness are two different things.
    The perception of loudness is related to sound pressure level, frequency and duration of a sound.
    You should look into automated methods to equalize sound pressure levels.

  2. I remember downloading a client (forget the name) for Linux that allowed me to purchase songs off iTunes in Linux. It took a lot of work to give Apple my money, but I wanted to pay for the music.

    A lot of the music files (still) don’t have metadata (a setback from using that client)

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!