Friday, October 04, 2024

Compression

A torturous torturous! slow day of headache inducing work on my compression algorithm. One annoying thing is that it seemed to work well from the first try, but every tweak needed multiple tests and so much kept causing little niggles. This is a case of slowly, ever slowly, working though every variable and possibility. Here is a wave (upper) with 2:1 compression at the grey line of 6dB.

See how the peaks beyond the grey line on the top trace are half the size of the peaks on the lower trace. It first uses a volume trace that has zero attack to catch the top peaks. This track opens the gate when it passes the threshold, and closes it when it falls below. Eventually I evolved and smoothed the code so much that I realised I'd not involved the gate at all and simply compressed values over the traced threshold! It worked really well, but without a gate it has limited settings (only ratio). Perhaps it would be useful like that anyway. In all of my years of using compression (which, I admit, is hardly ever, I compress vocals; I compress bass because it can change volume with each change of note, but I hardly ever compress anything else) I use the same settings of 1ms attack and 500ms release. I digress.

I added an automatic gain option to boost things, but it took me ages to work out why it sometimes went over the top, because it was calculated to exactly peak at 1.000, never more. I realised that values over the threshold can peak when they are not yet in the gate and so immune to the compression which would have limited them.

It's been such a long day of tedious tests and headaches.

I ask myself why I do such things. I painted 'A Brief History Of Transubstantiation' this year. Why would I? I have no plans to show it. It was not intended for a competition, it's not pretty, and on only a moderate technical level, so not a showcase. It's sufficiently odd that I probably won't show it to anyone, like several of my paintings. But, I found it a striking artwork and idea. I dreamed the image, and it struck me as having a truth. I painted it because it was in my nature to make art, and to push myself to do something well, and better than before.

Perhaps then, this is why I made this compressor, hard slog though it has been.