Wednesday, September 28, 2022

Peak Tracking and Cathedral Limiting

At last! After a week of tests and failed attempts at an automatic limiter which detects peaks and fades smoothly between the raw output and a gently limited output I have succeeded! The tricky part was the peak tracker. I needed a way to look ahead for peaks and grow slowly towards them, and sometimes, eventually, fall slowly away too, but not head down without reason... in a wave that wobbles up and down constantly, I could not ever have my trace under the actual peak AND needed to keep everything flowing very smoothly.

The algorithm was very complex to work out, looking towards distant peaks and calculating slopes, which should ideally be linear and take place over a long period for maximum smoothness. Last night I had a few ideas, and it worked! See the trace and the wave, here:

The wave below is set to a limit of 0.5 (the grey line) so anything about that should be tracked above. The trace above should track all peaks above 0.5. Here's the wave overlaid with the trace so you can see more clearly that the wave is constrained by it:

There are some opportunities for the trace to move closer, but it's hard to know those without our advance knowledge of what is coming next, and everything must move gently. This, as it is, is fine, and there is a time setting to control how far ahead to check.

Overall it works fine, amazingly good, actually. The end result is that I can now maximise the volume of a track in an interesting and neat way, without clipping it. Here is the Gothic Limiter, my basic limiter until today, limited to the space between the grey lines:

And below it there is the new 'Cathedral Limiter' which fits more in the same space with more dynamic range too.

One irony is that after this week or so of work on it, I'll probably never use it. This is one of those complex obsessive problems that I couldn't help but solve, but phew, now I have. I can now relax and get back to the Salome music...