DSPRelated.com
Forums

Resampling Questions - Newbie requests your help

Started by Please Respond Here January 17, 2004
I've got a single channel of 16-bit/44.1kHz audio that I'd like to resample to 
16-bit/88.1kHz. I'll start with this since I believe that it might be easier 
than dealing with uneven mutiples if I chose another rate (like 48kHz for 
example). Please let me know if my understanding is correct:

1. First I need to zero pad each sample. I assume that I can just write a 
simple program to do this part. Is there any reason to use cubic splines or a 
Lagrange interpolation here? It's my understanding that the latter two may be 
audible, so it's best to just use zero padding for audio. Won't my data file 
now be twice as large at this stage?

2. Next, I need to low pass filter the data. In order to just learn how this 
all works, couldn't I just use a simple 1st order filter with a corner 
frequency of 20kHz?

Not sure what else I need to do. I saw some diagram that illustrated an 
anti-imaging filter followed by an anti-aliasing filter. I'm unclear as 
to what the differences are. Won't the LPF I described handle both of these.

Please post your comments about how to resample audio at an even integer 
multiple sampling frequency.

Thanks.
RK

sorry I meant 16-bit/88.2kHz


In article <YUiOb.898$Ew2.412141677@newssvr11.news.prodigy.com>, 
pleaserespond@tothisgroup.com says...
> >I've got a single channel of 16-bit/44.1kHz audio that I'd like to resample
to
>16-bit/88.1kHz. I'll start with this since I believe that it might be easier >than dealing with uneven mutiples if I chose another rate (like 48kHz for >example). Please let me know if my understanding is correct: > >1. First I need to zero pad each sample. I assume that I can just write a >simple program to do this part. Is there any reason to use cubic splines or a >Lagrange interpolation here? It's my understanding that the latter two may be >audible, so it's best to just use zero padding for audio. Won't my data file >now be twice as large at this stage? > >2. Next, I need to low pass filter the data. In order to just learn how this >all works, couldn't I just use a simple 1st order filter with a corner >frequency of 20kHz? > >Not sure what else I need to do. I saw some diagram that illustrated an >anti-imaging filter followed by an anti-aliasing filter. I'm unclear as >to what the differences are. Won't the LPF I described handle both of these. > >Please post your comments about how to resample audio at an even integer >multiple sampling frequency. > >Thanks. >RK >
Got the answers to some of my questions.

For one, since I know which samples are zero-stuffed, I can reduce the number 
of MACs (in my case by half) since the zero-stuffed values don't contribute 
to the summation in the filter. So from what I can tell, I don't need to 
recreate a new file twice as long since the filter can be calculated 'on the 
fly'.

Also, the term I should have used was interpolation as this implies upsampling 
with filtering according to www.dspguru.com. So after completing the 
upsampling portion by zero-stuffing I'll need to add a LPF.

Does anyone know if using Lagrange interpolation or cubic splines is suitable 
for audio?



In article <nhjOb.899$7g3.415171735@newssvr11.news.prodigy.com>, 
pleaserespond@tothisgroup.com says...
> >sorry I meant 16-bit/88.2kHz > > >In article <YUiOb.898$Ew2.412141677@newssvr11.news.prodigy.com>, >pleaserespond@tothisgroup.com says... >> >>I've got a single channel of 16-bit/44.1kHz audio that I'd like to resample >to >>16-bit/88.1kHz. I'll start with this since I believe that it might be easier >>than dealing with uneven mutiples if I chose another rate (like 48kHz for >>example). Please let me know if my understanding is correct: >> >>1. First I need to zero pad each sample. I assume that I can just write a >>simple program to do this part. Is there any reason to use cubic splines or
a
>>Lagrange interpolation here? It's my understanding that the latter two may
be
>>audible, so it's best to just use zero padding for audio. Won't my data file >>now be twice as large at this stage? >> >>2. Next, I need to low pass filter the data. In order to just learn how this >>all works, couldn't I just use a simple 1st order filter with a corner >>frequency of 20kHz? >> >>Not sure what else I need to do. I saw some diagram that illustrated an >>anti-imaging filter followed by an anti-aliasing filter. I'm unclear as >>to what the differences are. Won't the LPF I described handle both of these. >> >>Please post your comments about how to resample audio at an even integer >>multiple sampling frequency. >> >>Thanks. >>RK >> >
Please Respond Here wrote:
> > Got the answers to some of my questions. > > For one, since I know which samples are zero-stuffed, I can reduce the number > of MACs (in my case by half) since the zero-stuffed values don't contribute > to the summation in the filter. So from what I can tell, I don't need to > recreate a new file twice as long since the filter can be calculated 'on the > fly'. > > Also, the term I should have used was interpolation as this implies upsampling > with filtering according to www.dspguru.com. So after completing the > upsampling portion by zero-stuffing I'll need to add a LPF. > > Does anyone know if using Lagrange interpolation or cubic splines is suitable > for audio?
The only resampling method suitable for audio is sinc interpolation. Try Secret Rabbit Code: http://www.mega-nerd.com/SRC/ Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo nospam@mega-nerd.com (Yes it's valid) +-----------------------------------------------------------+ UNIX *is* user-friendly, just picky about who it chooses for friends!
Erik de Castro Lopo <nospam@mega-nerd.com> wrote in message
news:400AE35D.4DBF5229@mega-nerd.com...
> Please Respond Here wrote: > > > > Got the answers to some of my questions. > > > > For one, since I know which samples are zero-stuffed, I can reduce the
number
> > of MACs (in my case by half) since the zero-stuffed values don't contribute > > to the summation in the filter. So from what I can tell, I don't need to > > recreate a new file twice as long since the filter can be calculated 'on the > > fly'. > > > > Also, the term I should have used was interpolation as this implies
upsampling
> > with filtering according to www.dspguru.com. So after completing the > > upsampling portion by zero-stuffing I'll need to add a LPF. > > > > Does anyone know if using Lagrange interpolation or cubic splines is
suitable
> > for audio? > > The only resampling method suitable for audio is sinc interpolation. > > Try Secret Rabbit Code: > > http://www.mega-nerd.com/SRC/
While I agree that sinc interpolation is superior, there has been plenty of audio interpolation done with Lagrange or other methods (even my PC's sound card/driver). Depending on the application and the signal, that may be adequate. But for top quality stuff, it often isn't. We've been discussing this a bit in the thread "Fast Interpolation ?". You might want to check that out as well.