DSPRelated.com
Forums

Filter values in multi-stage audio sample rate covnersion?

Started by damc4 June 24, 2005
Hello,

if I make a sample rate conversion using multi-stages (e.g. 48 kHz
downto to 44.1 kHz in 3 stages with the ratios 3/6, 7/4 and 7/5), do I
need different filter coefficients for the 3 filters or can I use
always the same filter, when the audio data frequence range itself is
limited to something like 22 kHz???



Thanks for your help!

damc

damc4 wrote:
> Hello, > > if I make a sample rate conversion using multi-stages (e.g. 48 kHz > downto to 44.1 kHz in 3 stages with the ratios 3/6, 7/4 and 7/5), do I > need different filter coefficients for the 3 filters or can I use > always the same filter, when the audio data frequence range itself is > limited to something like 22 kHz???
Although the absolute cutoff frequency can be the same, the normalized frequency (that is, fc/Fs) will be different for each stage. Unfortunately for you, digital filters only pay attention to the normalized frequency. BTW, your stages don't multiply out to 44.1/48. 3/6 should be 3/8 (typo?). Also, if you make the first stage 3/8, you're going to lose some serious bandwidth, as the sample rate between the first and second stages will be a mere 18 KHz. This has the additional implication that the first stage (if it's 3/8) cannot have a cutoff of ~22.05 KHz (it'll HAVE to be less than 9 KHz). -- Jim Thomas Principal Applications Engineer Bittware, Inc jthomas@bittware.com http://www.bittware.com (603) 226-0404 x536 In theory, theory and practice are the same, but in practice, they're not
"Jim Thomas" <jthomas@bittware.com> wrote in message 
news:11bo2sgjouka4a5@corp.supernews.com...
> damc4 wrote: >> Hello, >> >> if I make a sample rate conversion using multi-stages (e.g. 48 kHz >> downto to 44.1 kHz in 3 stages with the ratios 3/6, 7/4 and 7/5), do I >> need different filter coefficients for the 3 filters or can I use >> always the same filter, when the audio data frequence range itself is >> limited to something like 22 kHz??? > > Although the absolute cutoff frequency can be the same, the normalized > frequency (that is, fc/Fs) will be different for each stage. Unfortunately > for you, digital filters only pay attention to the normalized frequency. > > BTW, your stages don't multiply out to 44.1/48. 3/6 should be 3/8 > (typo?). > > Also, if you make the first stage 3/8, you're going to lose some serious > bandwidth, as the sample rate between the first and second stages will be > a mere 18 KHz. > > This has the additional implication that the first stage (if it's 3/8) > cannot have a cutoff of ~22.05 KHz (it'll HAVE to be less than 9 KHz). > > -- > Jim Thomas Principal Applications Engineer Bittware, Inc > jthomas@bittware.com http://www.bittware.com (603) 226-0404 x536 > In theory, theory and practice are the same, but in practice, they're not
fwiw...a month ago I posted some Simulink (R14SP2) models that illustrate almost this exact application here: http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=7743&objectType=file There are floating-point and fixed-point example versions available there. And yes, Jim is correct - the coefficients are different for every stage...and it is very important that the first filter stage does not lower the sampling frequency (in order to not lose your high fidelity audio spectrum right from the start...) Steve
Hello,

Jim, yes it was just a typo, 147/160 is the ratio, so it must be 3/8.
Jim and Steve, and again yes, I didn't cared for the posting about the
stage order.
I am aware that I shouldn't go below my destination frequency during
the conversion.
Steve, thanks for the link, I will have a look on it.

And thanks for the help. that was the hint I was looking for.

Damc

"damc4" <damc4@gmx.de> wrote in message
news:1119618058.260243.312230@g49g2000cwa.googlegroups.com...
> Hello, > > if I make a sample rate conversion using multi-stages (e.g. 48 kHz > downto to 44.1 kHz in 3 stages with the ratios 3/6, 7/4 and 7/5), do I > need different filter coefficients for the 3 filters or can I use > always the same filter, when the audio data frequence range itself is > limited to something like 22 kHz???
Just curious, what is the advantage of doing the 48/44.1 conversion in 3 stages versus a single stage?
Jon Harris wrote:
> Just curious, what is the advantage of doing the 48/44.1 conversion in 3 stages > versus a single stage? >
It can be cheaper. To realize some computational savings, you can use sloppy filters in the initial stages, so long as you protect the intergity of the /final/ passband. You can trash major portions of the intermediate passbands (by allowing aliasing), so long as you keep the trash out of the final passband. It always takes me a lot of work with pencil and paper to get my head around this in the interp/decimiate situation, but it's fairly straightforward in a decimate-only or interpolate-only scenario. Rick covers this in his book (pg 384 and onward of the 2nd edition). -- Jim Thomas Principal Applications Engineer Bittware, Inc jthomas@bittware.com http://www.bittware.com (603) 226-0404 x536 Failure is always an option
In article <11c0kjpo1s7ioeb@corp.supernews.com>,
Jon Harris <jon_harrisTIGER@hotmail.com> wrote:
>Just curious, what is the advantage of doing the 48/44.1 conversion in >3 stages versus a single stage?
I wonder if the OP was planning on using IIR/recursive filters instead of linear phase FIR filters for resampling. IMHO. YMMV. -- Ron Nicholson rhn AT nicholson DOT com http://www.nicholson.com/rhn/ #include <canonical.disclaimer> // only my own opinions, etc.

Ronald H. Nicholson Jr. schrieb:
> In article <11c0kjpo1s7ioeb@corp.supernews.com>, > Jon Harris <jon_harrisTIGER@hotmail.com> wrote: > >Just curious, what is the advantage of doing the 48/44.1 conversion in > >3 stages versus a single stage? > > I wonder if the OP was planning on using IIR/recursive filters instead > of linear phase FIR filters for resampling. > > > IMHO. YMMV. > -- > Ron Nicholson rhn AT nicholson DOT com http://www.nicholson.com/rhn/ > #include <canonical.disclaimer> // only my own opinions, etc.
Hi Ron, no. my target is an FPGA and I have no problems concerning performance or resource utilisation, so I realize it in the simplest way with FIRs. damc
Jim Thomas wrote:
> Jon Harris wrote: > >> Just curious, what is the advantage of doing the 48/44.1 conversion in >> 3 stages >> versus a single stage? >> > > It can be cheaper. To realize some computational savings, you can use > sloppy filters in the initial stages, so long as you protect the > intergity of the /final/ passband. You can trash major portions of the > intermediate passbands (by allowing aliasing), so long as you keep the > trash out of the final passband. > > It always takes me a lot of work with pencil and paper to get my head > around this in the interp/decimiate situation, but it's fairly > straightforward in a decimate-only or interpolate-only scenario. > > Rick covers this in his book (pg 384 and onward of the 2nd edition). >
It often makes the filter design easier as well. For instance to do a single stage decimation by 1024, would likely require a huge number of taps. This single filter may be impossible to design using the PM algorithm - Even in matlab, the filter length can usually only go to ~1200 taps before instabilities start to occur (YMMV). By breaking it up into several stages (because of the sloppier filters) the filter lengths are reduced, and thus you're able to design them. These ideas are clearly discussed in Crochiere & Rabiner's "Multirate Signal Processing" Cheers, David
"David Kirkland" <spam@netscape.net> wrote in message
news:XQawe.1493$Ai.282292@news20.bellglobal.com...
> Jim Thomas wrote: > > Jon Harris wrote: > > > >> Just curious, what is the advantage of doing the 48/44.1 conversion in > >> 3 stages > >> versus a single stage? > >> > > > > It can be cheaper. To realize some computational savings, you can use > > sloppy filters in the initial stages, so long as you protect the > > intergity of the /final/ passband. You can trash major portions of the > > intermediate passbands (by allowing aliasing), so long as you keep the > > trash out of the final passband. > > > > It always takes me a lot of work with pencil and paper to get my head > > around this in the interp/decimiate situation, but it's fairly > > straightforward in a decimate-only or interpolate-only scenario. > > > > Rick covers this in his book (pg 384 and onward of the 2nd edition). > > > > It often makes the filter design easier as well. For instance to do a > single stage decimation by 1024, would likely require a huge number of > taps. This single filter may be impossible to design using the PM > algorithm - Even in matlab, the filter length can usually only go to > ~1200 taps before instabilities start to occur (YMMV).
I agree with you when the resampling involves decimation only (or interp only). In this case, the resampling is from 48 to 44.1 which shouldn't need a very large filter. So in this specific case, I wouldn't say the filter design is consierably easier. Yes - the multi-stage approach could use sloppier filters but a straight conversion wouldn't result in a > 1000 taps filter (I've never done this but that's what my gut feel tells me...unless the required stop band attenuation is way way down there). Cheers Bhaskar
> By breaking it up into several stages (because of the sloppier filters) > the filter lengths are reduced, and thus you're able to design them. > > These ideas are clearly discussed in Crochiere & Rabiner's "Multirate > Signal Processing" > > Cheers, > David