# Gain of resonating filters

I'm trying to make a music instrument based on a resonator with a high Q, such as Ableton's Corpus and Ableton's Resonator (I think the former is based on a simple 2nd order resonant filter while the latter is based on feedback combs).

I could make the filters in Matlab without difficulty but my problem is with their gain and the range of their output.

Indeed, to avoid overflowing/saturation of the sound signal, I need to have an output always bounded to the [-1 ; 1] range. Furthermore, these resonators should be suited for processing any type of input : very small transients for percussive sounds as well as continuous noise or oscillators.

I have normalized my biquad and comb resonators to have unit gain at the resonance(s) independently of the Q factor or resonant frequency, based on JOS' book and the STK examples, to prevent overflowing in all cases. But obviously, depending on my filter's input length, the output range varies greatly (even if the input's range is [-1 ; 1]). Depending on the Q factor, there's also a huge variation.

I think I understand the reasons for that : if we take white noise for example, the power is distributed over the whole spectrum, so if you normalize the resonance gain so that it stays at 0dB and filter the noise with a high-Q, you're going to reduce the power of the signal a lot.

If you fix the resonance but change the input signal, it also makes sense that the length of you input is going to change the range of the output, given the recursive nature of the filter.

So my question is : is there some trick to normalise a filter to have an output in almost the same range as the input (or at least a quite constant range), regardless of the filter's Q and the input's length? If not, how are Ableton and other plug-ins designers doing it?

EDIT : One solution that I thought of would be to maximize the SNR for the average type of input, and then provide gain control at the input of the filter and/or a limiter at the output. Is there any better way of achieving what I want?

EDIT2 : Still no answer and I would really like to have some help with that... Any comment is welcome! I have tried on Matlab to find a way to predict the output range depending on

• the filter's parameters
• its frequency response
• the input's RMS
• the input's amplitude

but I haven't found it yet... If someone has a hint or a pointer I would really appreciate!

EDIT3 : By calculating the overshoot of the 2 poles filter (ie the maximum of the step-response), I can guess the maximum range of the output, which is already a start but the analytic solution of the filter's overshoot is very heavy, and it doesn't help finding a relation with the input's length/power, does it?

EDIT4 : After analysing Ableton's corpus a bit more deeply, it seems like there's not much done after all... here are some captures of Corpus' response to some inputs (settings are : type=beam medium, $tune=324.91$, $decay=5.0s$, $Dry/Wet=100%$ and all the rest at $0$) : ^ Impulse response, -30dB

^ Sine sweep, -30dB

^ noise, -30dB

But for example, if I input an impulse at 0dB I'm going to hear the sound clearly and if I input 0dB-peak white noise, I'm also going to hear the resonance perfectly whithout distortion (sound here) With my resonators - either from the EQ cookbook or from JOS's constant gain resonators, I have an extremely quiet output to impulse and normal for noise...

• you can have resonant band-pass filters that have peak gain of $Q$ and you can have identical resonant band-pass filters except they peak at a gain of $1$. the audio EQ cookbook has both of them (and they differ only in their passband gain). i might suspect you may want to split the difference and have the gain go up by $\sqrt{Q}$ as the resonance gets thinner in frequency. you might need to experiment with the perceived loudness. – robert bristow-johnson Jul 19 '17 at 9:02
• Thanks for your help! You're right, I can design my filter so that for a fixed input, the average gain stays similar whatever the parameters but my problem is that the input depends on what the musician does with the instrument: with Ableton's resonator for example I can apply the effect to any kind of input and the perceived loudness will be similar... I'll try some reverse engineering and edit my question – Florent Jul 20 '17 at 0:19
• @robertbristow-johnson : just edited with some images and sounds – Florent Jul 20 '17 at 1:16
• is what we are hearing a filterbank of BPFs set to harmonic frequencies or is your resonator a comb filter with a delay in it. is the Q about the comb filter feedback gain? – robert bristow-johnson Jul 20 '17 at 2:24
• It is Ableton's Corpus plug-in, so I'm not 100% sure of what is inside the box. But seeing the impulse response (cf edit4) I place my bet on a BPF bank. There is also another plug-in using comb filters (see OP) which I haven't deeply analysed yet. From what I understand of the Corpus plugin, the $decay$ parameter sets the resonance of the BPFs. – Florent Jul 20 '17 at 2:29