# How to draw the magnitude plot of a variable slope low/high pass shelving filter? (eg. as a function of cascaded shelving filters)

I am interested in making a magnitude graph of a variable slope low/high pass filter. I would like to set slope in dB/oct and a cutoff pitch. The y-axis should be amplitude from 0 to 1, and the x-axis should be frequency in Hz.

I have seen people construct very nice variable slope high/low pass filters, where a series of say 16 shelving filters are cascaded to create the desired effect. For example, in Reaktor: https://www.native-instruments.com/forum/threads/3-db-octave-lpf.323734/#post-1611335

These variable slope filters adjust the cutoff frequency of each individual filter to maintain an equally spaced interval between an arbitrary high point and the desired cutoff frequency. They will also evenly adjust the slope of each individual shelving filter to give the final dB/oct slope desired.

Here are the basic magnitude plots of low/high shelves, where c = cutoffFreq, z = zeroFreq, and where I got the equations: To graph a variable slope filter in the fashion I desire, I can just multiply ~16 of these variable slope equations in the same way, but I need to be able to figure out the parameters.

To elaborate, I know from the Reaktor variable slope filter project that the cutoff frequency per band in an array of shelving filters would be set from a global cutoffHz/cutoffPitch (where pitch means MIDI 1-135) knob as:

c[i] = cutoffHz * 2^((((135-cutoffPitch)/12) / numberBands) * i)

In an array of 16 bands, i = 0...15 and numberBands = 16.

But I am not sure how to get the z parameters per band to finish the graph. Any ideas for what the z formula might be in this case? Or any other suggestions?

• the Audio EQ Cookbook might have a nice variable-slope shelving filters for you. this answer tells you how to plot the magnitude frequency response for any biquad, not just shelves. – robert bristow-johnson Jun 19 at 22:42

## 1 Answer

If you can generate a grey noise signal to put through the filter, the amplitude can be plotted as the resulting graph. Also if you pitche a sine input to the function at every frequency that you wish to measure for, the sine's amplitude after the filter will be the result for every frequency.

I understand that i in this graph is the audio sample instance...

*c[i] = cutoffHz * 2^((((135-cutoffPitch)/12) / numberBands) * i)*

Then send sines through it at every of the 16 bands of the EQ and check the resulting maximum, i.e. from a loop of sines of 10 periods of samples at 16 frequencies. perhaps you have to fade the sine amplitude into the filter to avoid an artefact.