Reply by Eudes April 11, 20052005-04-11
>Exactly right. Though I think you left off "kHz" or something in your
sentence
>above: >"...use a cutoff frequency a few [kHz] lower..." >
Hi Jon ! I'm sorry, I am not a native english speaker, so sometimes my sentences may looks not to be very understandable ;-) . However your correction is correct !!! Eudes This message was sent using the Comp.DSP web interface on www.DSPRelated.com
Reply by Jon Harris April 11, 20052005-04-11
"Eudes" <youdeseo@yahoo.fr> wrote in message
news:Bbmdnf0wbqNM1sTfRVn-pg@giganews.com...
> Hello everybody > > Jon, > Yes I am using the resampling with polyphase filter implementation > > >"Yes. However, in practice sometimes you bring the cut-off frequency in > >slightly > >to trade off stop-band attenuation for pass band width." > > What you mean is that often we use a cutoff frequency a few lower than the > nyquist frequency to be sure to have de maximum attenuation needed in the > stopband ?
Exactly right. Though I think you left off "kHz" or something in your sentence above: "...use a cutoff frequency a few [kHz] lower..."
Reply by Jim Thomas April 11, 20052005-04-11
Eudes wrote:
>>"BTW, 5 sounds kinda low." > > Your are saying that Lx5 is a minimum for the taps number. In what range > do you suggest this factor should be ? between 5 and 10 ?
It depends on the desired SNR. Plot the frequency response of your filter and look at the amplitude of the first lobe. With Lx5, it's probably going to be pretty high. You need to design the filter such that it supresses the out-of-band components below your desired SNR. I have used Lx16 with "good enough" results for what I was doing. -- Jim Thomas Principal Applications Engineer Bittware, Inc jthomas@bittware.com http://www.bittware.com (603) 226-0404 x536 Sometimes experience is the only teacher that works - Mike Rosing
Reply by Eudes April 10, 20052005-04-10
Hello everybody


Jon,
Yes I am using the resampling with polyphase filter implementation

>"Yes. However, in practice sometimes you bring the cut-off frequency in >slightly >to trade off stop-band attenuation for pass band width."
What you mean is that often we use a cutoff frequency a few lower than the nyquist frequency to be sure to have de maximum attenuation needed in the stopband ? Jim, Thank you for your explanation, it's very clear. I think I understood If I take an example (Currently I use the relation numberOfTaps=Lx4 because it was easier in my code to use even numbers) : L=79; M=100; L/M=0,79; Old sample rate: 44100 Hz; New sample rate: 34839 Hz; NumberOfTaps = Lx4 = 316; Interpolated sample rate = 3483900 Hz; Cutoff frequency= nyquist frequency of the new sampling rate (34839/2)=17419,5; Reduced cutoff frequency = cutoff frequency/Interpolated sample rate =17419,5/3483900 = 0,005;
>"BTW, 5 sounds kinda low."
Your are saying that Lx5 is a minimum for the taps number. In what range do you suggest this factor should be ? between 5 and 10 ? This message was sent using the Comp.DSP web interface on www.DSPRelated.com
Reply by Jim Thomas April 8, 20052005-04-08
Jon Harris wrote:
> "Eudes" <youdeseo@yahoo.fr> wrote in message >>"the filter cut-off correspond to the old sample rate" = "the filter >>cut-off correspond to the old sample rate nyquist frequency (Fold/2)" ?? > > > Yes. However, in practice sometimes you bring the cut-off frequency in slightly > to trade off stop-band attenuation for pass band width. >
Eudes, don't forget that when you combine interpolation with decimation and use one filter, that filter operates at the interpolated sample rate. Your cutoff frequency is relative to the intermediate rate. For the taps=5*L argument it helps to think about what the interpolator is doing - inserting L-1 zeroes between every input sample (even if the zero-insertion process is virtual). If you try to upsample by 16 and use a 32-tap filter, each output sample will consider only 2 of the input samples. If you upsample by 512 with a 32-tap filter, most outputs will not consider /any/ of the input samples, and a few of the outputs will consider only one. With taps=5*L, each output will use 5 of the input samples. BTW, 5 sounds kinda low. -- Jim Thomas Principal Applications Engineer Bittware, Inc jthomas@bittware.com http://www.bittware.com (603) 226-0404 x536 Being a good example is hard. I'm trying to serve as a horrible warning instead. - Brian Crane
Reply by Jon Harris April 7, 20052005-04-07
"Eudes" <youdeseo@yahoo.fr> wrote in message
news:Utudncs-oLbgL8jfRVn-og@giganews.com...
> >> What I am not sure when I design the filter is how to choice the taps > >> number? > > > >It is based on your required filter performance. Longer filters > generally > >attenuate the alias frequencies better, that is, they do a better job of > >interpolating. The tradeoff is more memory, computation time, delay, > etc.. > > Is the number of taps dependant of the M and L factor? (In dspuguru > multirate algorithm, the author looks to use this relation: NumberOfTaps= > InterpolationFactor_L x 5 , but for high L value (due to particular ratio > L/M) it leads to a huge number of taps)
Yes, it is dependent, but if you use the polyphase implementation, the computation requirements don't change as you change M and L. In your example, if L is large, you would need to store more coefficients, but for any given sample, you would only need to use 5 of them. (I'm not sure where the number 5 came from, but I'm using it since you did.)
> >Here's a simple way of looking at it: if you are decreasing the sample > rate, > >the filter cut-off should correspond to the new sample rate. If you are > >increasing the sample rate, the filter cut-off correspond to the old > sample > >rate. > > "the filter cut-off should correspond to the new sample rate" = "the > filter cut-off should correspond to the new sample rate nyquist frequency > (Fnew/2)" ??
Yes.
> "the filter cut-off correspond to the old sample rate" = "the filter > cut-off correspond to the old sample rate nyquist frequency (Fold/2)" ??
Yes. However, in practice sometimes you bring the cut-off frequency in slightly to trade off stop-band attenuation for pass band width.
Reply by Eudes April 7, 20052005-04-07
>> What I am not sure when I design the filter is how to choice the taps >> number? > >It is based on your required filter performance. Longer filters
generally
>attenuate the alias frequencies better, that is, they do a better job of >interpolating. The tradeoff is more memory, computation time, delay,
etc..
>
Is the number of taps dependant of the M and L factor? (In dspuguru multirate algorithm, the author looks to use this relation: NumberOfTaps= InterpolationFactor_L x 5 , but for high L value (due to particular ratio L/M) it leads to a huge number of taps)
>Here's a simple way of looking at it: if you are decreasing the sample
rate,
>the filter cut-off should correspond to the new sample rate. If you are >increasing the sample rate, the filter cut-off correspond to the old
sample
>rate. >
"the filter cut-off should correspond to the new sample rate" = "the filter cut-off should correspond to the new sample rate nyquist frequency (Fnew/2)" ?? "the filter cut-off correspond to the old sample rate" = "the filter cut-off correspond to the old sample rate nyquist frequency (Fold/2)" ?? Many thanx for all the replies This message was sent using the Comp.DSP web interface on www.DSPRelated.com
Reply by Jon Harris April 6, 20052005-04-06
"Eudes" <youdeseo@yahoo.fr> wrote in message
news:9M6dnaX_PsrawsnfRVn-sA@giganews.com...
> > >what you need is a different set of interpolation coefficients for each > >fractional delay that your sample rate ratio requires. that is if your > >sample rate ratio was 19/13, then you would need 13 sets of FIR > >coefficients, one set for each 1/13th sample fractional delay. and you > >would skip 19 thirteenths of an input sample for each output sample. > > > > > >yes, in the manner alluded to above. if your interpolation factor is > >completely arbitrary, then you need a lot of sets of coefficients (i > would > >say about 512, from my own experience) and you can linearly interpolate > >between them for whatever precision of fractional delay you want. > > > > Hello, > > I'm not sure having understood , all of what you wrote. What you suggest > is to precaculate a lot of set of coefficients (512) and include them in > an header file for example?
Yes.
> Each of those set will correspond to 1 > interpolation factor?
Each will correspond to one fractional interval between samples. In the example of 512 sets of coefficients, each set corresponds to an interval 1/512 of a sample. Let's say you are trying to interpolate a value part way between samples 1 and 2, say 1.1953125, or 1+100/512. If you had 512 sets of coefficients, you would use the 100th set for calculating this sample.
> When you say "you can linearly interpolate > >between them for whatever precision of fractional delay you want." > I don't really understand.
OK, in my example above, I picked a fractional value that was exactly divisible by 512, so it would be perfect. Now instead, consider trying to compute the value at 1.2. This means you would need to use something part way between coefficinet sets 102 and 103. If you aren't too concerned with quality, you could just pick the closest set and use it, but for better results, you would interpolate between coefficient sets 102 and 103 and use that.
> Otherwise, > > Finally, I implemented an FIR filter designer using the Hamming windowing > theory. However the output sound is very low quality, I think there is > disortion. Next I will try to put a sine signal in input to be sure of > what is the problem. > Can we really design a FIR polyphase filter in designing a simple low-pass > FIR filter with Hamming?
Yes, there is no problem calculating the FIR coeffients with a Hamming window. You should take the ideal low pass filter (a sine(x)/x waveform) and then apply the Hamming or other window to get your coefficients.
> What I am not sure when I design the filter is how to choice the taps > number?
It is based on your required filter performance. Longer filters generally attenuate the alias frequencies better, that is, they do a better job of interpolating. The tradeoff is more memory, computation time, delay, etc..
> Moreover I dont understand, in the DSPguru FAQ : The cuttoff frequency > resampler FIR filter will have the lower cutoff frequency between the > decimator's one and the interpolator's one. > But the cutoff frequency of the decimator isn't always the lower (because > we decimate)? > And the cutoff frequency of the interpolator isn't always the nyquist > frequency (44100 /2) ?
Here's a simple way of looking at it: if you are decreasing the sample rate, the filter cut-off should correspond to the new sample rate. If you are increasing the sample rate, the filter cut-off correspond to the old sample rate.
> > > This message was sent using the Comp.DSP web interface on > www.DSPRelated.com
Reply by Eudes April 6, 20052005-04-06
>what you need is a different set of interpolation coefficients for each >fractional delay that your sample rate ratio requires. that is if your >sample rate ratio was 19/13, then you would need 13 sets of FIR >coefficients, one set for each 1/13th sample fractional delay. and you >would skip 19 thirteenths of an input sample for each output sample. >
>yes, in the manner alluded to above. if your interpolation factor is >completely arbitrary, then you need a lot of sets of coefficients (i
would
>say about 512, from my own experience) and you can linearly interpolate >between them for whatever precision of fractional delay you want. >
Hello, I'm not sure having understood , all of what you wrote. What you suggest is to precaculate a lot of set of coefficients (512) and include them in an header file for example? Each of those set will correspond to 1 interpolation factor? When you say "you can linearly interpolate
>between them for whatever precision of fractional delay you want."
I don't really understand. Otherwise, Finally, I implemented an FIR filter designer using the Hamming windowing theory. However the output sound is very low quality, I think there is disortion. Next I will try to put a sine signal in input to be sure of what is the problem. Can we really design a FIR polyphase filter in designing a simple low-pass FIR filter with Hamming? What I am not sure when I design the filter is how to choice the taps number? Moreover I dont understand, in the DSPguru FAQ : The cuttoff frequency resampler FIR filter will have the lower cutoff frequency between the decimator's one and the interpolator's one. But the cutoff frequency of the decimator isn't always the lower (because we decimate)? And the cutoff frequency of the interpolator isn't always the nyquist frequency (44100 /2) ? This message was sent using the Comp.DSP web interface on www.DSPRelated.com
Reply by robert bristow-johnson April 5, 20052005-04-05
in article 115394mekil1vfd@corp.supernews.com, Jon Harris at
jon_harrisTIGER@hotmail.com wrote on 04/04/2005 16:34:

>> there is a paper that Duane Wise and i did back in the 90's and Olli >> Niemitalo picked up on (link below) that tries to spell out the trade offs >> on this. >> >> http://www.biochem.oulu.fi/~oniemita/dsp/deip.pdf > > That's a good paper!
yeah, he did a really good (exhaustive) job. one thing that i tossed into Duane and my paper was a little handwavy theory to what the performance of different polynomial interpolators would look like. drop-sample you get 6 dB S/N for every octave of oversampling and linear interpolation you get 12 dB (with a couple of constant offsets), but the (crude) theory was in the ballpark of the numerically integrated results. the purpose was just to give me an idea of how many polyphases i needed to do arbitrary sample-rate conversion.
>> for 120 dB S/N in arbitrary ratio resampling, i have found that an >> oversampling ratio of 512 was good enough for linear interpolation and, >> IIRC, it was 512K for drop-sample (or Zero-order hold) interpolation. of >> course, the first requires two FIRs before linearly interpolating, and the >> latter is one FIR (and no further interpolation). > > Alternatively, you can interpolate the coefficients first, then run a single > FIR. This saves computations if you need to resample more than one channel of > audio (using the same parameters). Otherwise, it's a wash. >
-- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."