[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Resampling FIR Filter Parameters



Anyhow, here are some general points that may helpful.

Robert Olson wrote:

> If you want to peer at some existing code to compare to, the rat 
> engine can use digital filters for rate conversion.
>
> --bob
>
> At 03:43 PM 6/6/2002 -0700, Wesley Miaw wrote:
>
>> This email is sort of a "does anyone else know about this stuff" 
>> email. I have some idea of what I'm supposed to be doing, but it'd be 
>> nice if someone else also thought I knew what I was doing. At the 
>> very least, it will dump some information into the Open Mash archives.
>>
>> I have been unable to get Apple's AudioConverter subroutines to work 
>> correctly, so at this point, I have been looking at ways to resample 
>> the audio data myself. Specifically, I am trying to resample from 
>> 44.1kHz to 8kHz.
>>
>> I've found the OpenDSP software (http://www.dspguru.com/), which has 
>> C subroutines to decimate, interpolate, and resample audio data, but 
>> I need to create the resampling lowpass filter coefficients. To do 
>> that, I downloaded the trial version of ScopeFIR 
>> (http://www.iowegian.com/).
>>
>> To do this resampling, I need to interpolate first by 80 and then 
>> decimate by 441. So I need an interpolation filter for 80. With the 
>> trial version of ScopeFIR I can have up to 32 taps. Since the number 
>> of taps must be evenly divisible by my interpolation filter, I can 
>> interpolate first by 8 (32 taps) and then 10 (30 taps) to get 80 
>> total. Interpolating smallest to largest in two or three steps is 
>> recommended.
>>
>> Using ScopeFIR, it looks like the "Passband Upper Frequency" should 
>> be 4kHz, according to the Nyquist Theorem. I don't know what the 
>> "Stopband Lower Frequency" should be, but I'm just choosing 16kHz 
>> because that seems like a good frequency at which to cut off audio 
>> data based on acoustical models.
>
You need some space between your highest freq. of interest and the 
Nyquist freq. Set the passband upper freq. to around 3.7 kHz, as that 
will get most speech through OK and give you a 600 Hz guard band to the 
start of your stopband lower freq. It should be 4.3 kHz. Why? To prevent 
audio components starting at 4.3 kHz and up from aliasing to 3.7 kHz and 
down, which could greatly add to the noise level in your 0-3.7 kHz 
passband of interest, especially with high frequency implosive sounds 
like "s" and "f".

>> I have no idea what values to put for "Passband Ripple in dB" or 
>> "Stopband Attenuation in dB". But, a passband ripple of 3dB seems 
>> okay based on the last paragraph of 
>> http://www.appsig.com/papers/tn070/tn070_2_2.html. (Political Note: 
>> All papers should be available free in their entirety in lots of 
>> places on the Internet.) Since 3dB was suggested in the ScopeFIR 
>> tutorial along with 40dB for the stopband attenuation, I suppose 40dB 
>> must be okay as well.
>
I'd tighten up the passband to 2 dB and relax your stopband to 30 dB 
because reducing your aliased signals by that amount will probably do 
just fine.

>> Those values actually result in a very clean filter in ScopeFIR, so 
>> I'm going to try them. But, does anyone on here know anything about 
>> this that might be able to help me figure things out better?
>
32 taps is an artificial limitation and you'd probably have 
significantly better results with longer filters, at some computational 
cost. There are also optimizations that you can make that could reduce 
computational loading significantly.


/--- Ed Suominen -------------------------------\
|> Registered Patent Agent
|> Independent Inventor of EE Technology
|> Author, PRIVARIA Secure Networking Suite
||  Freely available at http://www.privaria.org
\--- http://www.eepatents.com -----------------/