R128 Normalizing & Lisp



Ahh… you gotta love Lisp…

I just sat down this evening and added about 50 lines of code to my Loudness Scanner, turning it into a mini-database so that I can recall any album and see the information on each track. And when I click on a track, it brings up its time history and histogram for the loudness, as shown here:

Those 50 lines took several iterations, of course, and about 2 hours of my time.

Every time I scan an album of tracks, it collects the information on each track into an album bundle structure, and adds/replaces that album in the database.

An album is just a collection of 1 or more audio files that I drop at once onto the scanner. The album name is derived from the containing folder name, or else, if that folder is named Unknown Album, I use its containing folder name, which is generally the artist’s name.

The database is stupid simple – just a hash table. It gets stored/recalled using object marshaling to/from disk under ~/Documents/EBU R128 Album-LUFS.dat”. When in use, it is entirely memory resident, and very fast to access – only a few MB of data.

The only kind of audio file that I haven’t been able to scan is Apple’s M4P encrypted format. Thankfully, that kind of DRM nonsense is behind us now.

All other formats are readily handled by converting them to temporary WAV or AIF format, using an automatically dispatched tool already provided by Apple, called afconvert. So I only need to be able to decode one or two formats, and the utility handles all the other formats to one of those for me in preparation for each scan. That all happens under the table, so you aren’t even aware of it.

I can search manually for any fragment of an album name, or I can resort to that alphabetized list display shown above.

So my normalization data is always readily available when I need to see what level to set my input faders.

  • DM

[ BTW… the scanner is extremely fast at scanning tracks. Typically about 50-100 times faster than realtime. So that track shown above at 3 mins duration, took only about 2-3 seconds to scan.

The scanner uses a carefully crafted C support library that resorts to low-grade SIMD parallelism in the FPU. All R128 filtering, true-peak upsampling and detection, and audio power estimation occurs there, with samples recorded every second across the track for the history displays. ]

Author: dbmcclain

Astrophysicist, spook, musician, Lisp aficionado, deaf guy

Leave a Reply