From: robert bristow-johnson on 8 Jun 2010 11:51 On Jun 8, 8:41 am, "PaulTapper" <paul__tapper(a)n_o_s_p_a_m.hotmail.com> wrote: > Hi, and thank you all for your responses. > > My specific application is a software implementation, not hardware, in a > context where the sample rate is unknown at the outset (although it is very > likely to be within the range of 11kHz to 96kHz). > > The filters I'm interested in are Biquads, so pretty simple. One HPF and > one high shelf. I have the coefficients for the desired frequency response > at one specific sample rate, and want to be able to generate a biquad with > similar freq response for a given sample rate at run-time. > > The converting to S-plane, and then back again idea sounds promising. and totally unnecessary, if what you're doing is designing biquads of a "standard" shape for different sampling frequencies. did you know about the Audio Eq Cookbook? it seems to me to be the simplest, quickest means to get the coefficients you want for a variety of sample rates. dunno what your platform is, but you can probably compute the coefficients on the fly. r b-j
From: Rob Gaddi on 8 Jun 2010 12:35 On 6/8/2010 1:18 AM, Rune Allnor wrote: > On 8 Jun, 02:52, Vladimir Vassilevsky<nos...(a)nowhere.com> wrote: >> Jerry Avins wrote: >>> On 6/7/2010 8:18 AM, PaulTapper wrote: >> >>>> Hi, >> >>>> Is there a standard way of converting an IIR filter to a different sample >>>> rate? >> >>>> What I mean by this is, if I have an IIR filter F0 with a particular >>>> frequency response at sample rate S0, and I want to create a filter F1 to >>>> give, as near as possible, the same frequency response, at a different >>>> sample rate S1, is there a standard way of calculating the >>>> coefficients of >>>> F1 from F0? >> >>>> My initial thoughts are that maybe I can find the zeroes and poles, and >>>> then rotate them around the unit circle or something, but I suspect there >>>> may be a standard solution to this problem? >> >>> Why not design a new filter to the original response specs? Even if >>> there were a simple transformation, the prewarping would be wrong. >> >> The problem stated by OP is quite common. Of course, it is possible to >> design a filter to a new sample rate from scratch. However this implies >> pretty extensive floating point math with libraries which could be too >> heavy for the target hardware. > > Would one do filter *design* with scarce computational > resources? I think of design as something done once up > front, on a PC, and then the coefficints might be > downloaded to whatever device that would actually run > the filter. > >> If this is a case, I prefer interpolation >> between the sets of coefficients. > > Sure. With FIRs this would be possible. But IIRs? > > Rune Not sure if you could interpolate the coefficients, but you could at least interpolate the poles, then throw some quick math at it to turn them into biquads. If you've got two different, stable, IIR filters, both have their poles entirely inside the unit circle. The line connecting them, representing the set of all possible interpolations, also has to be entirely inside the unit circle. If you interpolate it in Cartesian coordinates you'd probably want a pretty fine set of choices to pick through in order to keep from getting too far towards the center, but with a radial interpolation you could probably do the OPs required span on 3, maybe 4 templates. -- Rob Gaddi, Highland Technology Email address is currently out of order
From: Tim Wescott on 8 Jun 2010 12:57 On 06/08/2010 01:18 AM, Rune Allnor wrote: > On 8 Jun, 02:52, Vladimir Vassilevsky<nos...(a)nowhere.com> wrote: >> Jerry Avins wrote: >>> On 6/7/2010 8:18 AM, PaulTapper wrote: >> >>>> Hi, >> >>>> Is there a standard way of converting an IIR filter to a different sample >>>> rate? >> >>>> What I mean by this is, if I have an IIR filter F0 with a particular >>>> frequency response at sample rate S0, and I want to create a filter F1 to >>>> give, as near as possible, the same frequency response, at a different >>>> sample rate S1, is there a standard way of calculating the >>>> coefficients of >>>> F1 from F0? >> >>>> My initial thoughts are that maybe I can find the zeroes and poles, and >>>> then rotate them around the unit circle or something, but I suspect there >>>> may be a standard solution to this problem? >> >>> Why not design a new filter to the original response specs? Even if >>> there were a simple transformation, the prewarping would be wrong. >> >> The problem stated by OP is quite common. Of course, it is possible to >> design a filter to a new sample rate from scratch. However this implies >> pretty extensive floating point math with libraries which could be too >> heavy for the target hardware. > > Would one do filter *design* with scarce computational > resources? I think of design as something done once up > front, on a PC, and then the coefficints might be > downloaded to whatever device that would actually run > the filter. > >> If this is a case, I prefer interpolation >> between the sets of coefficients. > > Sure. With FIRs this would be possible. But IIRs? Why not? You'd have to make sure that you had enough sets so that the interpolation would always cough up a good filter, but it should work. You could probably increase the stride size of your tables if you stored the filter coefficients as complex pole values, then interpolated those pole positions. Going from a complex pole pair to an IIR filter doesn't take anything heavier than multiplication and addition; a tool set that doesn't have floating point math for that is pretty lame. -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
From: Rune Allnor on 10 Jun 2010 05:37 On 8 Jun, 18:35, Rob Gaddi <rga...(a)technologyhighland.com> wrote: > On 6/8/2010 1:18 AM, Rune Allnor wrote: > > > > > > > On 8 Jun, 02:52, Vladimir Vassilevsky<nos...(a)nowhere.com> wrote: > >> Jerry Avins wrote: > >>> On 6/7/2010 8:18 AM, PaulTapper wrote: > > >>>> Hi, > > >>>> Is there a standard way of converting an IIR filter to a different sample > >>>> rate? > > >>>> What I mean by this is, if I have an IIR filter F0 with a particular > >>>> frequency response at sample rate S0, and I want to create a filter F1 to > >>>> give, as near as possible, the same frequency response, at a different > >>>> sample rate S1, is there a standard way of calculating the > >>>> coefficients of > >>>> F1 from F0? > > >>>> My initial thoughts are that maybe I can find the zeroes and poles, and > >>>> then rotate them around the unit circle or something, but I suspect there > >>>> may be a standard solution to this problem? > > >>> Why not design a new filter to the original response specs? Even if > >>> there were a simple transformation, the prewarping would be wrong. > > >> The problem stated by OP is quite common. Of course, it is possible to > >> design a filter to a new sample rate from scratch. However this implies > >> pretty extensive floating point math with libraries which could be too > >> heavy for the target hardware. > > > Would one do filter *design* with scarce computational > > resources? I think of design as something done once up > > front, on a PC, and then the coefficints might be > > downloaded to whatever device that would actually run > > the filter. > > >> If this is a case, I prefer interpolation > >> between the sets of coefficients. > > > Sure. With FIRs this would be possible. But IIRs? > > > Rune > > Not sure if you could interpolate the coefficients, but you could at > least interpolate the poles, then throw some quick math at it to turn > them into biquads. Still don't see how this would work. Could you sketch an example? Rune
From: SG on 10 Jun 2010 13:06 On 8 Jun., 14:41, "PaulTapper" wrote: > > My specific application is a software implementation, not hardware, in a > context where the sample rate is unknown at the outset (although it is very > likely to be within the range of 11kHz to 96kHz). > > The filters I'm interested in are Biquads, so pretty simple. One HPF and > one high shelf. I have the coefficients for the desired frequency response > at one specific sample rate, and want to be able to generate a biquad with > similar freq response for a given sample rate at run-time. This could be done via "frequency warping". Assume you have a biquad H given as b0 + b1 z^-1 + b2 H(z) = ----------------- 1 + a1 z^-1 + a2 which does something "interesting" with a "corner frequency" f in radian (i.e. -3dB cutoff frequency or the resonance frequency, etc). Then by replacing z^-1 with a simple all-pass of the form p + z^-1 A(z) = ---------- 1 + p z^-1 in H(z) you will get another biquad H(A(z)) where the corner frequency has moved up or down depending on the warping parameter p. I don't recall the exact relationship between f, p and the resulting "corner frequency" f'. But it's a fairly simple relationship if I remember correctly. It should be easy to compute p in a way so that new new filter's "corner frequency" is where you want it to be: // returns the frequency warping parameter so that // the cutoff frequency / resonance frequency / whatever // moves from freq_rad1 to freq_rad2 ... double warping_param(double freq_rad1, double freq_rad2); So, in case you have a lowpass filter with a cutoff frequency of 10 Hz for a smapling rate of 100 Hz and you want a similar filter for 120 Hz you'd use freq_rad1 = 10*2pi/100 freq_rad2 = 10*2pi/120 and use the to-be-implemented function from above to compute p and alter your coefficients b0,b1,b2 and a1,a2 according to p. I actually used something like this to adapt an ATH-based noise shaping filter to different sampling rates (in a limited range like 32-48 kHz) where I simply set f so it corresponds to around 4 kHz. It's not perfect, but it works. At low frequencies you have a nearly linear scaling effect. Around around Nyquist/2 the magnitude response just moves up or down and doesn't really expand or narrow. Cheers! SG
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: please DSP simple FPGA example Next: implementing MUSIC/Pisarenko algorithm in Matlab |