# IIR constant Q bandpass filters

Started by July 10, 2006
```Hi,

I would like to apply constant Q IIR filters to a music signal of 44100Hz
where each filter matches the frequency of the western well tempered
tuning system. This equates to 12 tones per octave.

At the moment I have achieved this using large custom FIR filters in
Matlab and it takes 5 minutes to process 1.1s of data!

I would like to apply IIR filters and end up with an envelope of the
resulting signal.

Can someone point me in the right direction as to how I would implement
such filters? I am using Matlab to engineer my prototype.

Many thanks,
Brett

```
```>Hi,
>
>I would like to apply constant Q IIR filters to a music signal of
44100Hz
>where each filter matches the frequency of the western well tempered
>tuning system. This equates to 12 tones per octave.
>
>At the moment I have achieved this using large custom FIR filters in
>Matlab and it takes 5 minutes to process 1.1s of data!
>
>I would like to apply IIR filters and end up with an envelope of the
>resulting signal.
>
>Can someone point me in the right direction as to how I would implement
>such filters? I am using Matlab to engineer my prototype.

Hi,

With matlab you can use "butter" to calculate the coefficients
for an iir bandpass.

[b,a] = butter(n, [Wl, Wh])
band pass filter with edges pi*Wl and pi*Wh radians

(or cheby1, cheby2, ellip for other filter types)

You could probably just replace your FIR filters with IIRs.
If I understand you correctly you want to build a filterbank
and track the amplitudes of the outputs?
There are probably much better ways like a multirate filterbank.
But if you just tune 127 (full midirange) iir bandpass filters and
send the absolute value of the outputs through moving average filters
for amplitude tracking you should be able to run this thing in
realtime if you want.  I saw such a system running on an old
apple computer (quadra or powermac) in realtime.

gr.
Anton

```