crystalizer

Watch on youtube.com
doc

https://ffmpeg.org/ffmpeg-filters.html#crystalizer

[me@host: ~]$ # set 1 as the intensity of effect (default: 2.0)
[me@host: ~]$ ffplay some.wav -af "crystalizer=i=1"
[me@host: ~]$ # disable clipping
[me@host: ~]$ ffplay some.wav -af "crystalizer=i=10:c=0"

The commandline in uploaded video was:

[me@host: ~]$ for f in *.wav ; do \
> for i in 0 1 2 5 10 ; do \
> echo -n "i=${i}" ; sleep 1 ; \
> ffplay -f lavfi "
> amovie=${f}
> ,crystalizer=i=${i}
> ,atrim=0:4
> ,asplit[a1][a2];
> [a1]volume=0.3[out1];
> [a2]showcqt=s=$((16*70))x$((9*70))[out0]
> " -autoexit 2>/dev/null ; done ; done

The offcial documents just say “Simple algorithm to expand audio dynamic range.”, but according to its source code (af_crystalizer.c), what this filter does is apparently illustrated as follows:

../_images/crystalizer_behaviour.png

The source code is as follows:

af_crystalizer.c
for (n = 0; n < nb_samples; n++) {
    for (c = 0; c < channels; c++) {
        float current = src[c];

        dst[c] = current + (current - prv[c]) * mult;
        prv[c] = current;
        if (clip) {
            dst[c] = av_clipf(dst[c], -1, 1);
        }
    }

    dst += c;
    src += c;
}

The slope is added to each sample value. I agree that this process is for “crystallizing”, but I don’t know why this is explained as “expanding the dynamic range”.