Forums

Oversampling using Cheby2 IIR FIlter.

Started by Emiliano March 22, 2006
I have to use a cheby2 IIR filter with 60db bandstop ripple to implement 
oversamplig procedure.
I'm sure that I can calculate the coefficient with matlab in few minutes, 
but in my application I have to calcute it in real time depending on the 
cut-off frequency. My question is: thers is an analitic rappresentation of 
the transfer function of cheby2 filter dapending on the frequency in laplace 
domain?
Thanks in advance,
Emiliano. 


Emiliano wrote:

> I have to use a cheby2 IIR filter with 60db bandstop ripple to implement > oversamplig procedure. > I'm sure that I can calculate the coefficient with matlab in few minutes, > but in my application I have to calcute it in real time depending on the > cut-off frequency.
Hi Emiliano, if I understand this correctly, you have to dynamically "shift" or "switch" the filter's cut-off frequency - and you are not concerned about the transient effects. You might find this approach helpful: Instead of moving the filter's cut-off frequency, you might modify the actual sampling rate across the filter. Example: Assuming a sample rate of 1000 S/s, and an initial cut-off at 100 Hz. With the same filter coefficients, but running at 2000 S/s , the filter would present a cut-off at 200 Hz. Now, instead of modifying your filter coefficients, you just use sample-rate conversion to adjust the cut-off frequency. I was able to use this method successfully and with much less computational requirements than when directly calculating the coefficients.
> My question is: thers is an analitic rappresentation of > the transfer function of cheby2 filter dapending on the frequency in > laplace domain?
Yes, sure. However, it's rather complicated, since it deals with sin/sinh terms which are certainly not well-suited for your implementation. I found one in [Ifeachor, Jervis; Digital Signal Processing: a practical approach" by Ifeachor, Jervis, Addison Wesley 1993, ISBN 0-201-54413-X]. A rather simple approach to calculate the coefficients for cheby filters can be found in an old edition of ["The Scientist and Engineer's Guide to Digital Signal Processing", Steven W. Smith, 2nd ed, p. 334ff.]. I guess that this is still available online though I don't have a reference.
> Thanks in advance, > Emiliano.
Bernhard
> Hi Emiliano, > if I understand this correctly, you have to dynamically "shift" or > "switch" > the filter's cut-off frequency - and you are not concerned about the > transient effects.
Yes, I'm developed a virtual 44100Hz wav sampler and when I have to play note: "SI" that have Fs - Fs/12 frequency respect the original sound (that i assume "DO") I can listen a strange mettalic sound that is pratically deleted with an high order alliptic IIR filter, but in this application I have to calculate an elliptic filter for any note (oversampling filter) in real time.
> You might find this approach helpful: > Instead of moving the filter's cut-off frequency, you might modify the > actual sampling rate across the filter.
I don't understand how can I use this approach in oversampling/antialiasing procedure. Thanks, Emiliano.
Emiliano wrote:

>> Hi Emiliano, >> if I understand this correctly, you have to dynamically "shift" or >> "switch" >> the filter's cut-off frequency - and you are not concerned about the >> transient effects. > > Yes, I'm developed a virtual 44100Hz wav sampler and when I have to play > note: "SI" that have Fs - Fs/12 frequency respect the original sound (that > i assume "DO")
Sampling frequency is 44.1kHz (Fs) ? You want to process a tone of 44.1kHz*11/12 = 40.425kHz ?
> I can listen a strange mettalic sound that is pratically > deleted with an high order alliptic IIR filter, but in this application I > have to calculate an elliptic filter for any note (oversampling filter) in > real time. > >> You might find this approach helpful: >> Instead of moving the filter's cut-off frequency, you might modify the >> actual sampling rate across the filter. > > I don't understand how can I use this approach in > oversampling/antialiasing procedure.
I don't, either. I supposed you want to implement a cheby2 filter before your oversampling stuff. In this case, the filter implementation could be independent on the subsequent steps. Bernhard
>> Yes, I'm developed a virtual 44100Hz wav sampler and when I have to play >> note: "SI" that have Fs - Fs/12 frequency respect the original sound >> (that >> i assume "DO") > Sampling frequency is 44.1kHz (Fs) ? > You want to process a tone of 44.1kHz*11/12 = 40.425kHz ?
Yes.
> I supposed you want to implement a cheby2 filter before your oversampling > stuff. In this case, the filter implementation could be independent on the > subsequent steps. > Bernhard
Ok. Emiliano.
Emiliano wrote:

   ...

[Bernhard Holzmayer wrote:]

>>Sampling frequency is 44.1kHz (Fs) ? >>You want to process a tone of 44.1kHz*11/12 = 40.425kHz ? > > > Yes.
... All frequencies in the sampled data will be below 22.05 KHz with a sampling frequency of 44.1 KHz. that is why frequencies above that must be removed /before/ sampling takes place. If 40.525 KHz is allowed into the sampler, it will appear in the result as 3.575 KHz. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
> All frequencies in the sampled data will be below 22.05 KHz with a > sampling frequency of 44.1 KHz. that is why frequencies above that must be > removed /before/ sampling takes place. If 40.525 KHz is allowed into the > sampler, it will appear in the result as 3.575 KHz.
Yes, but if you read a wav sample, for example, you are sure that there's not frequency above 22.05 Khz. The problems comes out when you oversampling this data by factor 1.1, in this case you have aliased components at high frequency thah you have to filter out. Emiliano.
Emiliano wrote:
>>All frequencies in the sampled data will be below 22.05 KHz with a >>sampling frequency of 44.1 KHz. that is why frequencies above that must be >>removed /before/ sampling takes place. If 40.525 KHz is allowed into the >>sampler, it will appear in the result as 3.575 KHz. > > > Yes, but if you read a wav sample, for example, you are sure that there's > not frequency above 22.05 Khz.
I don't know what you're trying to convey. Do you want to analyze 40.525 (44.1*15/16) or not? You wrote earlier that you do.
> The problems comes out when you oversampling this data by factor 1.1, in > this case you have aliased components at high frequency thah you have to > filter out.
They have to be filtered out of the signal before it's sampled. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Emiliano wrote:

> The problems comes out when you oversampling this data by factor 1.1, in > this case you have aliased components at high frequency thah you have to > filter out. > Emiliano.
Hi Emiliano, just to make sure we speak the same language, I'll try to illustrate this: 1) initial data contains frequencies < 22.05kHz. 2) Now you do oversampling by a factor 11 this is, you fill ten samples between each of the original samples either zeros (with a reconstruction filter behind) or interpolated values (which assumes the filter in the interpolation algorithm) 3) Now you have data with the same real frequency content as before, however, since the sample distance now corresponds to 11*Fs, your effective sample rate is 485.1kS/s. 4) Since the inserted samples are not perfectly correct, they'll introduce high frequency content which is undesirable, if you want to downsample afterwards. If the target sampling rate of the following downsampling is 48.51kS/s (factor 1.1), you'll have to make sure that the high-frequency stream has no frequencies higher than 24.255kHz. 5) Now you downsample with a divisor of 10, which means that you take every tenth sample out of the stream. This results in 1.1*Fs, your effective sample rate is now 48.51kS/s, while the possible frequeny range is now <24.255kHz. The real frequency content doesn't change, so it is still <22.05kHz. The only place where errors are introduced, is, because you insert non-perfect samples in step 2). Therefore the reconstruction filter is necessary to avoid antialiasing in step 5). If your reconstruction/antialiasing filter in step 4) is not ideal, I'd expect to find additional artifacts coming from the sample rates (44.1kHz, 48.51kHz, differences of both 4.41kHz including all sort of overtones. Neither of them could be successfully suppressed by a low pass filter behind the conversion. Are you talking about a filter to do this reconstruction? If so, remember that this filter's passband must be up to 22.05kHz, since the real frequency content doesn't change, that it's stopband requirement at frequencies above 24.255kHz results from the acceptable noise of the final data, and that it's sample rate is 485.1kS/s. The requirements would not change, if you would do the upsampling by 1.1 in one step. However, you wouldn't have a possibility to introduce the filter. Does this help? Bernhard
> Does this help?
Perfect, this is the answer to my question! Thanks, Emiliano.