# Normalizer
"Good-enough" remastering to roughly equalise dynamic range and overall loudness, intended for
DJs who play older tracks and/or tracks across many genres. Not intended for non-dance music
genres, but should work well enough for them anyway.
This works by configuring some limiters and compressors in `ffmpeg` based on the detected
[perceptual loudness](https://en.wikipedia.org/wiki/Loudness) of the track across various
time periods. It works completely differently from [`ffmpeg-normalize`](https://github.com/slhck/ffmpeg-normalize),
which is intended to preserve the waveform, only scaling it down so that different tracks are the same
overall loudness when the whole track is measured. This program _will_ change the sound of your tracks.
While `ffmpeg-normalize` is intended to trust the master that is given to it and only prevent you
from needing to adjust your volume when putting many tracks in a playlist, this tool is intended to
take tracks mastered in many different styles with different loudness profiles across the track and
optimise dynamics for club play. It uses compression and limiting to remaster the track, giving you a
reasonable baseline to make mixing tracks and making mashups much easier. It can also
It can also be used as a quick-and-dirty way to master unmastered tracks for club play, without using
an AI service like LANDR. I have tried it on unmastered tracks and it does appear to work pretty well,
producing masters that are at least reasonably listenable. For one of the tracks I tried from my album,
it produced something that actually sounds better on my phone speakers than the professional master due
to the reduced dynamic range, although on better speakers the transients are too loud and it's obviously
not even close to the quality of a professional master - nor is it intended to be. It currently makes no
attempt to handle the frequency distribution of a track (e.g. normalising tracks that have much more bass
vs tracks with much less), as `mcompand` (`ffmpeg`'s multiband compressor) appears to be bugged and
produces extremely ugly artifacts no matter the settings.
For comparison, here is an older track mastered pretty quietly that I've had trouble playing in sets
because the dynamics didn't match the loud hard house and rave music that I usually play. The settings
used are pretty extreme because it needs to match the dynamics of the rest of my playlist which
have loud, aggressive masters. However, despite the fact that the waveform looks clipped the
final exported file doesn't sound distorted because of the use of multiple limiters and compressors. This
is in line with how modern dance music is usually mastered, with waveforms that look clipped but do not
distort.
![Before](assets/winditup-before.png)
![After](assets/winditup-after.png)
## Installation
You will need `ffmpeg` (see [their website](https://ffmpeg.org/)) and `cargo` (see [rustup](https://rustup.rs/))
## Usage
You can either run from source with `cargo run --release -- [args..]` or use `cargo install normalizer` and then
run `normalizer [args..]`. If running from source, `--release` is important! The loudness analysis will be extremely slow
without it. The most-common usecase would be `cargo run --release -- -o