CLI Loudness script

Based on discussions in the Complete Classical Music workflow, I present a command-line script to calculate individual track values of integrated LUFS, LRA and true peak using ebur128. In addition it will calculate the album integrated, LRA and TP and present all information in an html table format as well as on the screen.

Prerequisites: ebumeter, sox

Usage example: album-ebur128 *.flac

I recommend copying to /usr/local/bin or other appropriate directory included in $PATH. The loudness_analysis.html file is created wherever the script is run.

Thanks to @x42 for the tip about piping concatenated files to ebur128.

Any feedback for improving the likely inefficient scripting is very welcome as are any feature requests. A good use case for this script would be for comparing reference albums in order to achieve similar loudness values in an Ardour mastering session. Perhaps, also, a final check post-export.

3 Likes

Great work @anon60445789! Working fine here, but I had the same issue, I had to run before: sudo dos2unix /usr/local/bin/album-ebur128 for to use it on AntiX.

1 Like

Yeah, it works. However now you have to add .bash in the command, and in the output, the first line says that there is no such file or directory, but then everything goes well.

album-ebur128.bash *wav

$ album-ebur128.bash *wav
/usr/local/bin/album-ebur128.bash: línea 1: #!/bin/bash: No existe el fichero o el directorio

You definitely don’t need to be adding .bash to anything to run it as an executable script. I think you should just copy the text using the green icon at the top of the paste.ee window and paste into a new file in featherpad or whatever Linux editor you use. Save as /usr/local/bin/album-ebur128 (or whatever you like!) and make it executable.

I think downloading the file directly from paste.ee adds the .bash by default and also the problematic Byte-order Mark (or BOM) that gives you the error on line 1. My original file and text pasted from paste.ee as suggested do not give this BOM error.

Can anyone suggest if I can do something differently or whether this is accepted practice to copy/paste versus downloading the file? Is this a common occurrence with pastebin sites? Even though my original file seems great, at some point in the chain of making this available for public use, either a BOM error or CRLF breaks are introduced.

Yes. I did and is working absolutely fine. Good work, maybe you should not use pastebin or similar, only let download the file from Drive or similar, at least for the moment.

1 Like

KT Tunstall’s KIN album broke my script :wink:

Turns out that the comma in the filename of track 5 “It Took Me so Long to Get Here, But Here I Am” caused the HTML table generation code to split the filename into two separate cells, thereby shifting numeric values one cell to the right.

Fixed script by adding a sed line to remove any commas in the generated filename list (N.B. This only affects the temporary list and NOT your files!). OP has the updated script.

1 Like

A group like this is normal that can break a script… hahaha

Updated and working.

Thank you @anon60445789!!