|
|
Re: Upsample/FIR/downsample
Posted:
Aug 9, 2007 12:22 PM
|
|
On Wed, 08 Aug 2007 21:28:07 -0000, robert bristow-johnson <rbj@audioimagination.com> wrote:
>On Aug 8, 4:21 pm, R.Lyons@_BOGUS_ieee.org (Rick Lyons) wrote: >> On Wed, 08 Aug 2007 17:31:32 -0000, robert bristow-johnson >> >> <r...@audioimagination.com> wrote: >> >> >> >it depends on if you are ultimately upsampling (M<L) or downsampling >> >(M>L). that's why i said >> >> > h = fir1(N-1, min(1/M,1/L), kaiser(N,7.8562)); >> >... >> Regarding the fir1's freq argument, when >> I looked at mpowell's original decimation >> code, and the interpolation code example in MATLAB's >> hardcopy User's Manual, I originally thought >> mpowell made an error in his >> >> h = fir1(N,1/M,kaiser(N+1,7.8562)) >> >> where M = 160. >> >> It took me a while to figure it out (and it >> surprised me a little), with MATLAB's formating >> the fir1's freq argument should always be 1/160 >> REGARDLESS of whether your interpolating or >> decimating!! > >i don't think i agree, Rick. if you're UPsampling (switch the values >for M and L around, M=147 and L=160) then you want the cutoff >frequency to be Nyquist/L, no? > >e.g. converting a sound file from CD sampling rate (44.1 kHz) to DAT >or DAW or "studio" sampling rate (48 kHz). so now the intermediate >upsampled frequency is the same 7.058 MHz (44.1kHz*160), but now you >want your cutoff to be half of the source sampling rate (22.05 kHz), >not half of the destination sampling rate (which is higher, 24 kHz). >your 7 MHz intermediate signal will have images at 44.1, 88.2 and so >on. there might be something between 22.05 and 24 kHz that you don't >like. > >when up-converting, there should be no loss of information, but there >will be holes in the spectrum of the intermediate over-sampled >signal. when down-converting, to prevent aliasing, you must filter >your input signal to even less of its Nyquist (to that of the final >Nyquist). > >i think it should be the Nyquist*min(1/L,1/M), and in fir1() (and all >other things MATLAB), "Nyquist"=1. > >that's my story, and i'm stickin to it. > >r b-j
Well, if your text:
"min(1/L,1/M)"
means "the minimum of 1/147 or 1/160", then min(1/L,1/M) always equals 1/160, right. All I was tryin' to say was that the fir1's freq argument should always be 1/160 whether we're interpolating by 160/147 or decimating by 147/160.
As far as I can tell we're in agreement.
[-Rick-]
|
|