1

The web audio biquad filter is 12db. Is it possible to create a 24db filter by connecting 2 of these together?

I have tried connecting 2 together and it certainly creates a much more extreme effect with the resonance being particularly harsh. I divided the resonance value by 2 to compensate for this.

Is what I have created here a 24db filter?

ezero
  • 1,230
  • 3
  • 12
  • 27

1 Answers1

4

Yes, what you are referring to is called cascading. If you consider the output of the first stage, it has a 12db/oct rolloff. Now if you put that into the second stage it will operate on the signal in complete isolation of the first stage so if it has another 12dB/oct rolloff at the same corner frequency then your final output will have 24dB/oct rolloff. In other words you just if you plot the frequency response of the two filters and add them together you'd get the overall response of the system.

Generally you think of filters as attenuating the signal only, but fiddling with the Q or using the peaking filter for example can give you boost at certain frequencies. When you consider the filter responses being added together then you also have to realize that the gains can add together and cause clipping.

I'm not familiar with the way web audio goes about it's filter design so I would suggest either poking around in the code (if it's available) or measuring your filter's frequency response.

jaket
  • 9,140
  • 2
  • 25
  • 44
  • Great answer, thanks. The Q will definitely be fiddled with in my app so I have halved the max Q setting of each filter to avoid most of the clipping. – ezero Feb 13 '15 at 21:35
  • I'm not exactly sure what the Q is doing say in the case of a lowpass filter. The prose isn't very clear on the subject. The detailed specs are in here: http://webaudio.github.io/web-audio-api/#filters-characteristics but I haven't studied them. fwiw, the api is very limiting in that it doesn't let you specify the filter coefficients directly so you can use something like matlab to design a proper higher order filter. You're stuck with their course few building blocks. – jaket Feb 14 '15 at 00:00
  • 2
    We (Mozilla) are experimenting with the possibility to set coefficients, as well as the memory of the filter. More info here: http://txt.paul.cx/biquad-coefficients – padenot Feb 15 '15 at 17:44
  • @padenot - that is awesome! Any chance of getting into the standard? – jaket Feb 16 '15 at 21:40
  • If there is enough interest (an email is fine, with pain points/comments), I can try to push it into the standard, yes. – padenot Feb 16 '15 at 22:22
  • @padenot. Can you send me the contact info? jaket@ap.com – jaket Feb 17 '15 at 23:09