1
$\begingroup$

I'm trying to create a low pass FIR filter using the coefficients I found in ITU 1770-3 on page 18. This is the last piece of the puzzle for an audio loudness metering algorithm I'm working on.

enter image description here

I'm not super familiar with digital filters in general, but so far I've been able to create them using numerator and denominator coefficients. From there I can use filter(b,a,input) to process the audio.

But I'm not quite sure what to do with these 4 sets of coefficients. Am I supposed to get a set of numerators/denominators out of them somehow? What can I do to create an LPF out of these coefficients?

UPDATE: With some sage advice from @DanBoschen I have modeled the filter. Here is the response chart:

LPF response

$\endgroup$
  • $\begingroup$ Hi! It would be super well if you could also upload a sufficient amount of MATLAB / OCTAVE snippet... $\endgroup$ – Fat32 Sep 27 '18 at 20:58
  • $\begingroup$ Hi @Fat32, the rest of my MATLAB script is kind of unrelated to this filter so I thought it might just add clutter. So far the script basically just reads an audio file and measures ungated and gated loudness. This LPF here is supposed to be the pre-filter for the true peak measurement portion, which I'm just starting. All I have done so far to create this LPF is store these coefficients in vectors p0, p1, p2, and p3 for each phase listed here. Just need to figure out what to do next to create a filter and then I can put that in with the rest of my script. $\endgroup$ – Avid Pro Tool Sep 27 '18 at 21:10
  • $\begingroup$ Yes of course the whole code would indeed be a clutter, but you can isolate the rest of it as an emulated interface and provide only the portion related with your problem. That's what the snippet is ;-) $\endgroup$ – Fat32 Sep 27 '18 at 21:30
  • $\begingroup$ Not sure what you mean by an emulated interface, forgive me I'm pretty new at this. Unfortunately, I don't really have any code to show that's related to this problem, other than the 4 vectors storing the coefficients listed above. I figured if I typed out "p0= [0.0017089843750 0.0109863281250....]; p1=[....]..." that wouldn't add much to it. I think there's just a broader concept about digital filters I'm missing here and can't seem to find the answer online. $\endgroup$ – Avid Pro Tool Sep 27 '18 at 22:06
3
$\begingroup$

These appear to be the coefficients of a linear phase (due to the even symmetry of the coefficients) 48 tap low pass filter arranged in polyphase structure and given the words interpolator in the title, for purpose of upsampling the input signal by a factor of 4.

I have detailed the approach to designing a polyphase interpolator from the FIR coefficients in this post: How to implement Polyphase filter? , with the image copied below that specifically shows how a traditional FIR structure is mapped to a polyphase structure for interpolation using to row to column mappings of the coefficients:

Polyphase Implementation

In the case of this specific 48 tap implementation in this post given as four 12 tap polyphase filters, the signal would first be upsampled with a zero insert just as done in the diagram I posted above (so insert 3 zero's in between each input sample resulting in a 4x increase in the sample rate). The low pass filter is designed to pass the signal of interest and reject the images that the zero-insert creates. (I have more details on that specifically but that's more detail than necessary to answer the question so will lean slightly toward brevity--- if anyone wants that added, please indicate in the comments). In this case given the completed design, a 48 tap filter was determined to be sufficient by the designer, and this was then mapped into four 12 tap poly-phase filter structures (instead of four 2 tap filters in my image above) as follows:

For FIR filter with taps h[0], h1, h[2].... h[47]

This is mapped into four poly-phase filters as:

Filter 1: h[0] h[4] h[8] h[12] ... h[44]

Filter 2: h[1] h[2] h[3] h[4] .... h[45]

Filter 3: h[2] h[3] h[4] h[5] .... h[46]

Filter 4: h[3] h[4] h[5] h[6] .... h[47]

The columns given by the OP are the taps for each of the four filters as detailed above. To view the filter response, read the coefficients back in order from each row as listed and then can use the freqz command available in Matlab, Octave or Python (SciPy) to view the response.

$\endgroup$
  • $\begingroup$ Thank you very much for your detailed response! Trying to catch up, this is great info. So far I am able to arrange these coefficients in a single vector (I've called it "p"), and the freqz() function will show me something that looks like a LPF. Now I'm trying to figure out how to run my input signal through that filter. The input signal came from a .wav file using the audioread() function. I've tried filter(p,input) and filter(p,input,1/192000) (since it'll be at 192kHz) but I get an error saying the first two arguments must be vectors. I think it's expecting numerator/denominator vectors. $\endgroup$ – Avid Pro Tool Sep 27 '18 at 23:28
  • $\begingroup$ use filter(p, 1, input) $\endgroup$ – Dan Boschen Sep 27 '18 at 23:29
  • $\begingroup$ The filter assumes a rate that is four times faster than the given input, so to model the actual implementation with the interpolation, first do the zero insert by first adding three zeros in between every (do you know what I mean by that?) and then follow that with filter(p, 1, newInput) $\endgroup$ – Dan Boschen Sep 27 '18 at 23:31
  • $\begingroup$ The polyphase structure is just an efficient way to implement the same thing, but the above approach will match your inputs and outputs exactly so is a precise model. Can you add the frequency response as an update to the bottom of your question? (Just would like to see what the filter is and didn't want to transcribe all your coefficients). $\endgroup$ – Dan Boschen Sep 27 '18 at 23:32
  • $\begingroup$ yes I've used the upsample() function for that. This filter was the last missing piece, thank you for taking the time to help me out! $\endgroup$ – Avid Pro Tool Sep 27 '18 at 23:33

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.