The Absolutely Baching Volume Maximiser

1.0 What is MAXV?

For reasons that needn't detain us, loudness (measured in "decibels", abbreviated as "dB") in music recordings is usually worked on a negative scale, where 0 dB is the loudest and -1 dB is a little bit quieter and -11dB is considerably quieter than that and so on.

In theory, a CD recording should have its loudest music recorded at 0dB. That would be the theoretical maximum volume an audio signal could get without introducing 'clipping' or other distortion.

Quite often, however, and usually for various technical reasons to do with the need to prevent complex digital recording and processing equipment introducing audible artefacts into a music signal, CD recordings are sometimes mastered at levels much lower than 0dB.

Famously, for example, SACD recordings are generally recorded with an absolute reduction in volume of around -6dB. The result is that an SACD recording ripped to a hard drive will sound considerably fainter than it really ought to.

You will also sometimes find ordinary CDs which have two or more works supplied on the one disc -and the same volume constraint has been applied to all of them, disc-wide, instead of different volume levels being applied to each work individually. Imagine a CD containing a large symphony and a spinet sonata: if you applied the same volume setting to the entire disk, the loudest parts of the symphony might well come in at near 0dB, but the quietest parts of the spinet sonata might then be coming in at -20dB, making it practically inaudible!

Fortunately, such mastering horrors on ordinary CDs are fairly rare these days, in my experience -but they do still exist, especially if you are in the habit of buying second-hand CDs from charity shops: they will often be fairly old, and so date from early on in the CD era, when digital techniques were not quite so well mastered as they are nowadays!

So I wanted a tool that could simply boost the volume levels of all tracks in a folder in a consistent way that wouldn't introduce new distortion or audible artefacts.

That tool is MAXV.

MAXV first analyses all music files located in a folder. It determines the absolute peak volume of the loudest of those tracks. If that volume level is considerably less than 0dB, it will then boost the volume of the audio signal in all tracks by whatever fixed amount is needed to get the loudest track to nearly 0dB. (For safety reasons and out of an abundance of caution, MAXV seeks to get the loudest tracks to -0.5dB, not actually 0, but it's close enough!)

2.0 Obtaining and Installing MAXV

Installing MAXV is a simple process of issuing the following commands:

wget https://absolutelybaching.com/abc_installer
bash abc_installer --maxv

The first command downloads a generic installer script. The second command is an instruction to run that installer script, specifying (with a double-hyphen parameter) that it's MAXV you want to install. You will be prompted at one point for your sudo password, without which the installer cannot install the software in the /usr/bin folder correctly.

2.1 First Run

Once installed, MAXV needs to be run (by typing maxv) in a folder containing FLAC music files. It won't work outside such a folder, nor will it work in a folder containing, say, MP3 or APE music files: only FLAC files need apply! If you try running the utility in a folder that lacks FLACs, you'll see this:

Assuming there are some FLACs present when first run, MAXV will begin by analysing your system to determine if necessary prerequisite software is present:

That's an example from a system running Fedora -so, MAXV knows to prompt you to install missing packages with the 'sudo dnf install' command. On Ubuntu, it will tell you to use 'sudo apt install' and on OpenSuse, it will tell you to use 'sudo zypper in'... and so on. It's main-distro-aware, in other words, and will provide distro-appropriate prompts whenever it can.

Notice, too, in this specific example, that MAXV knows the ffmpeg package it needs can only be installed on Fedora if the RPM Fusion repository has been enabled. You can do that with these two commands:

sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
sudo dnf install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

On OpenSuse, you will receive a similar extra message telling you to install the Packman repository (for the same sorts of reasons that Fedora needs the RPM Fusion one!). That’s done with the following one-liner:

sudo zypper ar -cfp 90 http://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Leap_15.2/ packman

With that repository enabled, you can re-run MAXV and again see the ‘you are missing software’ warning -but the command to install it all will now be capable of completing successfully!

2.2 Subsequent Runs

If you have installed the prerequisite software and are running MAXV in a folder full of FLAC files, you'll see the program do its work something like this:


The program doesn't prompt you or anything like that: it simply gets straight to work analysing each of the FLAC files found. You'll notice that as it checks each track, it displays a number at the end of each line of output: that number is the peak decibel level of the track in question. Though the numbers are displayed without negative signs in front of them, they are actually negative values, where 0 represents the loudest a track could possibly be and a value of 9 being a very quiet track and a value of 19 being practically inaudible.

In the example shown here, therefore, we see that track 1 is already at volume 0: it's as loud as it can possibly be, so no volume boost can be applied to it without distorting the audio signal. So even though track 2 is significantly quieter than track 1 (having a peak volume of 3.6dB below 0), it can't be volume-boosted without altering the relative loudness between tracks 1 and 2. Similarly, whilst all the other tracks could be volume boosted by various amounts, to do so would be to change the relative loudness of the four tracks of this symphony's recording, and MAXV will never do that. Accordingly, you get a message that because 1 track is already as loud as it can be, no tracks can be volume-boosted: the overall loudness for all tracks is already optimised.

2.3 A Volume-Boosting Example

In a different run of the MAXV utility, using a different symphony's recording, I get this output:

Again, the utility simply gets down to analysing each track's loudness without prompting. In this case, it notices that all four tracks are quite a bit off the theoretical maximum of zero decibels. The loudest track is actually track 3 -a 0.9dB level is quite close to zero, but still quite a bit away from it.

MAXV therefore offers to boost the audio in all tracks (so as to maintain inter-track relative loudness) by whatever it takes to get track 3 to its maximum possible loudness.

You get to choose whether you want this volume boost applied or not.

If you don't want it applied, just type 'n' and press [Enter]. The default is 'Y', yes, please apply the volume boost, so you can just press [Enter] on its own to accept that (or type 'y' and [Enter] if you prefer). If you choose to volume-boost, this happens:

Firstly, MAXV re-computes the volume boost amount. Though it knows that a 0.9dB boost would get track 3 to the 'ideal' zero level, it is more cautious than that and knocks 0.5dB off that possible boost to be on the safe side. It thus goes ahead and applies a 0.4dB boost instead, to every track in the folder. That is enough to lift track 3 from -0.9dB to -0.5dB, getting it closer to the zero mark; but it uplifts the other tracks too, by the same amount (so track 1 would go from being -2.2dB to -1.8dB, for example).

Because of this 0.5dB 'safety cushion', MAXV won't bother to offer a volume boost if it ever discovers the loudest track in a folder is already within 0.5dB of zero. If peak volume is, for example, discovered to be 0.3, it will just say 'the volume levels are already optimised', because it can't apply a meaningful boost to a track that's already within 0.5dB of zero.

2.4 Aftermath

After a volume boost has been applied to music tracks in a folder, this is the result:

Notice that the four original tracks of the symphony (here called 'split-track-<something>) have been joined by four new tracks called '-.4-dB-<something>'.

That is, the non-volume-boosted original files remain, unaltered, just as they were originally ripped or supplied. But four additional files now exist, with filename prefixes that match the volume-boost that MAXV has just applied (so, in this case, given that a +0.4dB volume boost was applied, all the files have .4-dB prefixes.

MAXV never destroys the original files, in other words. (But see section 2.5 below!!)

The original files are always left behind so that you can listen to the new files and compare them to the originals and satisfy yourself that a meaningful volume boost has taken place without introducing audible distortion or artefacts.

If you were to re-run MAXV at this point, it will only notice the existence of the original files: it is blind to any file whose name contains a '-dB-' string in it, anywhere. Therefore, a second run of MAXV in the same folder will detect exactly the same volume levels in the still-present original files as before and will thus create a new set of volume-adjusted files with precisely the same names as before. The newly-boosted files will therefore simply over-write the previously-boosted ones.

If you dislike the effect of the volume boost, just use your file manager to select-and-delete the '+dB' prefixed files. If you prefer the volume-boosted ones, use your file manager to delete the non-prefixed originals. In every case, you delete the files you no longer want to retain. MAXV never deletes anything for you -making it entirely safe to run at all times.

(Incidentally, if you dislike the look of the volume-boosted file names, you could use CCDT option 7 to alter the names to be whatever the track's ALBUM tag is, as would be normal practice; or use CCDT to assign an ALBUM tag to a file in the first place. In either case, CCDT will get the physical file names looking normal again).

2.5 Deletion of Source Files

Starting with MAXV Version 1.06 and above, MAXV can and will delete the source files if you ask it to by specifying --delete or --d on the command line as you invoke the program. The presence of either of those switches on the command line at runtime will cause MAXV to do everything already described but, in addition and at the end of all processing, it will delete any FLAC file found that does not have a -dB- component to its file name. Since all the volume-boosted files will have that in their file names, the only files that can match this test are the original, non-volume-boosted ones. The deletion of these -db-less files therefore leaves behind only the volume-boosted files.  Finally, MAXV will rename the volume-boosted files to strip out the -dB- prefix in their names, and to replace the .flac.flac endings to their names with a rather more conventional '.flac' extension. The result will be that the files will look identical to the originals when viewed in a file manager: there will be nothing to indicate that MAXV has done any work at all, in fact. The only thing that gives the game away is that if you were to re-run MAXV at this point, it would declare that the volume level was already optimised for this set of FLACs -because, of course, the volume boost has already been applied to them.

This delete-source functionality was only added several versions after MAXV was first released -largely because I didn't entirely trust what it was doing to my audio files! I therefore needed to be able to revert to 'the originals' at any moment when I first starting using the utility. However, months of daily use of MAXV has now made me entirely comfortable with what it does and, specifically, I'm now completely confident that it doesn't introduce distortion or other audio artifacts. Hence, several months on, I thought it appropriate to trust it sufficiently to at least give it the option of doing all the deletes and file renames I had hitherto been having to do manually. I would suggest that you approach this functionality in a similar sort of way: get used to running MAXV without deletes first, for several weeks or months, and only when you are confident of its results, take advantage of the fact that, with --delete, MAXV can now make the entire volume-boosting process practically invisible and self-tidying.

3.0 General Usage Notes

MAXV generally takes no run-time arguments, parameters or switches. Simply type 'maxv' in a folder full of FLACs, and it will do its work.

However, from version 1.05 upwards, you can specify --colour-light, --colour-dark or --colour-neutral parameters to make MAXV more visible/legible for those with colour perception issues. All those parameters can also be spelled as the Americans would, with 'color', without the 'u'. Also from version 1.05 and up, you can supply the --checkver parameter to perform an automated check for newer versions of the software (and to upgrade to newer versions if any are found, though you can decline the upgrade if it's offered). And from version 1.06 onwards, you can supply --delete to automate the deletion of source files and the renaming of their volume-boosted replacements.

MAXV only works on FLACs, not on any other type of audio format (so, no APE, MP3, OGG or other formats are supported).

If you ask it to do a volume boost, MAXV always outputs 16-bit, 44.1KHz sample rate 2-channel FLAC files (the same sort as you'd get if you ripped an ordinary CD).

MAXV never destroys, deletes or alters original input files. Those are always preserved, even if a volume boost is applied to copies of them, which are made dynamically. Thus, if a volume-boost is applied, two sets of FLAC files will result: the originals and the volume-boosted copies. Deciding which of the two sets to keep is entirely down to you and requires manual file deletion of the unwanted set, using whatever file management tools you're comfortable with. Note that this behaviour changed slightly in version 1.06 and above, where it became possible to specifically request for the source files to be deleted after a volume-boost has been applied, leaving only the volume-boosted files behind at the end: but you have to explicitly request the behaviour. Even in version 1.06 and above, MAXV will still not destroy the original files by default.

MAXV will compute a volume boost amount that will make the loudest file in a folder get to -0.5dB, which is just shy of the absolute loudest non-distorted volume theoretically possible of 0dB. Any folder that contains a file with a pre-existing maximum volume of 0 to -0.5dB cannot therefore be volume-boosted further, and MAXV will declare such a folder to be already volume-optimised.

MAXV never adjusts relative volumes. Since it applies a fixed volume-boost to all tracks equally, whilst the absolute volume of all tracks will increase, their relative differences are retained. That is, if you had tracks at -7, -3 and -2dB, you will end up with tracks at -5.5,  -1.5, -0.5dB. There was a 1dB difference between the last two tracks before the volume boost: there remains a 1dB difference between those same tracks after the volume boost. The original 4dB difference between tracks 1 and 2 is similarly preserved after boosting.

Common sense dictates that you should use MAXV after you have separated the compositions contained on a single CD into separate folders. If a CD contains a loud symphony and a quiet sonata, then having all files in one folder will mean that the sonata can only be volume boosted by whatever small volume-boost that the already-loud symphony can take. Split the two works into separate folders, however, and the loud symphony can get a small MAXV boost, and the quiet sonata can get a much bigger MAXV boost. This of course changes the relative loudness between the two works -but since they are entirely independent compositions, this seems quite a reasonable thing to do!

Author

MAXV was devised and written by Howard Rogers ([email protected]).

License

MAXV is copyright © Howard Rogers 2020, but is made available freely under the GPL v2.0 only. That license may be downloaded here.

Bugs Tracking, Feature Requests, Comments

There is no formal mechanism for reporting and tracking bugs, feature requests or general comments. But you are very welcome to email your comments to [email protected].