Wrote a limiter, currently writing a synth, who wants to beta test/see a tutorial on it?

tutorials
#1

Hey folks, I’m getting to the point with a dual mono limiter project (that is a small part of a bigger synth project) that I can start getting some beta testers! And for all the noobs out there, if you’re interested in learning how I wrote this, the bigger synth project will be documented in a course that teaches C++, Juce and Audio programming from scratch with zero prior programming experience required.

If you’re interested in checking out the limiter or want to learn how to write it, let me know via the link in the description here:

The bigger synth project is here:

3 Likes

#2

With the attack knob being there, isn’t this more of a compressor than a limiter?

0 Likes

#3

that’s a good question lol

it’s a peak limiter and just kinda makes sure stuff never goes over 0 dbFS. Apple’s own AUPeakLimiter has an attack knob, so I’m not really sure it’s wrong for a limiter to have an attack knob.
51%20PM

0 Likes

#4

In the AUPeakLimiter the Attack Time is working as a lookahead time, you can hear this by quickly changing the attack time, it creates some glitches even with no gain reduction. That’s the delay line.

I’d say as long as it really never goes over 0dBFS, you can call it a limiter. Implementing real lookahead limiting is not trivial. Most people on the internet think it’s just delaying the signal where gain reduction is applied without delaying the sidechain signal. However, in that way transients are clearly missed. In fact, it comes down to delaying both, with an additional time-reverse filtering of the gain reduction. So basically the attack time in AUPeakLimiter is more of a time-reverse release time :slight_smile:

0 Likes

#5

good to know. sounds like you’ve written a couple limiters yourself.

0 Likes

#6

Just one for Ambisonics: https://git.iem.at/audioplugins/IEMPluginSuite/tree/master/OmniCompressor
The compressor class (in the resources directory in the repository) uses a peak level detector, so with Attack set to 0 it acts as a limiter. The class writes the gain reduction for each sample to an AudioBuffer (or float array) which is then time-reverse filtered by the LookAheadGainReduction class.

1 Like

#7

I am wondering, how that would be the case:
The measuring finds the transient being over the threshold, you go back in time thanks to your delay, and the attack phase ends exactly at the found sample applying the necessary reduction.
The only thing you have to make sure, that you adapt the reduction, since the next exceeding sample will most likely exceed the value even more…

0 Likes

#8

Yes that’s how it’s done.
However, most algorithms or suggestions to implement lookahead I have seen on the internet don’t line up that attack phase. They just delay the signal… So in that case, the gain-reduction will set in too early, and the transient will come in while the limiter is already in release mode.

That’s why you have to do that time-reverse filtering, which isn’t exactly a filter, you can rather see it as a one sided filter, it basically just checks whether a gain-ramp has to be applied or not. My LookAheadGainReduction class exactly does this.

0 Likes

#9

Oh great, yes my design takes that into account as well :slight_smile:

And I agree, renaming the attack makes sense, and it is set equal to the lookahead, so it is redundant information anyway.

The only reason to keep it separated might be, you don’t want to adapt your latency each time the user plays on the knob…

0 Likes

#10

Sorry to hijack this thread for this, to test my limiter I used the following audio file:


a constant sine at 8kHz with an amplitude of 0.2 and a a dirac impulse in the middle at 0dB

With a lookahead limiter, the result should look like this:

What you see is that the signal is attenuated shortly (5ms, linear) before the impulse comes in. Right after the impulse you see the release curve (exponential).

The limiter was set to -10dB which is 0.316

1 Like

#11

Tadah…

you can see it ramping down before the spike, and ramping back up after it.

@danielrudrich Why exactly did you hijack this thread? You don’t even know how I went about implementing the gain reduction or look-ahead. So why even come at me with the “I bet you did what everyone else on the internet thinks you need to do” vibe?

1 Like

#12

I did not mean to offend you in any way or criticize your implementation. If I communicated with that vibe, I am very sorry! I guess I should have posted this to the other thread here on the forum with the discussion about lookaheads and not use this one. Just thought this might be interesting for everyone who’d like to get some information about this topic.

4 Likes

#13

It’s all good, relevant information. The number of people reading the forum contains many more people who don’t know these things than do.

1 Like