I am trying to implement some code to firstly generate an Octave-Band and Fractional-Octave Band filter. I have used MATLAB's octaveFilter method to generate compliant Class-1 and Class-0, 1/1 and 1/3 Octave band filters, but I want to understand how to design these filters from scratch so I can better understand their construction. Then I want to go on to implement in code. So the coding environment doesn't matter, but I want to understand the filter construction from the filter definition/algorithm.

My problem is that the documentation for MATLAB's octaveFilter method doesn't explain the algorithm used to create the filters, nor does it explain how the filter is applied to data programmatically.

Can someone please point me to some material that explains how to create these filters, for any centre frequency I choose, and then implement in code? Many thanks!

  • $\begingroup$ MATLAB's document does explain the algorithm to design the filters. The analog prototype is designed by cascaded Butterworth filter, and then is mapped to a digital filter using a bandpass version of the bilinear transformation. $\endgroup$
    – ZR Han
    May 25 at 9:27
  • $\begingroup$ @ZRHan could you then translate the process into pseudocode so that I can understand the process? I seem to be missing the knowledge link to take the equation and graph shown by the MATLAB document and translate it into code. That's what I'm trying to understand. Thanks! $\endgroup$
    – MDT
    May 26 at 3:03
  • $\begingroup$ See here bilinear transform $\endgroup$
    – ZR Han
    May 26 at 3:22
  • $\begingroup$ And this paper: All About Audio Equalization: Solutions and Frontiers $\endgroup$
    – ZR Han
    May 26 at 3:30
  • $\begingroup$ @ZRHan thank you! Those references are very helpful too! :) $\endgroup$
    – MDT
    May 28 at 2:17

That's actually rather simple.

A little bit of trial and error will do the trick. The standard specifies upper and lower limit for the transfer function of the filter. So you can just try a normal Butterworth bandpass and see what happens.

The picture below shows a 3rd octave design at 1kHz and a sample rate of 48 kHz. A 2nd order bandpass isn't quite a good enough for class 1 limits, but a 3rd order does the job just fine. The 4th (and higher) order works as well.

Once you have a design that works at 1kHz, you can apply the same design to every other center frequency as well. At very high frequencies you will see some bilinear frequency distortion. Depending on your application you want to adjust for this or not.

Things to tweak are filter order, filter type and exact location of the corner frequencies. In the example the "nominal" corner frequencies worked just fine.

enter image description here

  • $\begingroup$ That is a very logical and helpful response. Thank you. May I ask, where can I find the pseudocode/process for implementing a normal Butterworth bandpass filter? I'd like to be able to program the function to create one of these... :) $\endgroup$
    – MDT
    May 26 at 3:05
  • $\begingroup$ Butterworth filters are probably the most frequently used IIR filter there is and there a plenty of libraries for many programming languages. If you want to design it from scratch, look at something like dsprelated.com/showarticle/1128.php $\endgroup$
    – Hilmar
    May 26 at 13:16
  • $\begingroup$ thank you for that excellent article! $\endgroup$
    – MDT
    May 28 at 2:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.