
February 2nd, 2010, 02:15 PM
#1
Upsampling algorithm
Hey, I need to find an algorithm that will upsample from 11.025 kHz to 16.0 kHz. I am having trouble writing one. Does anyone have any insight or has anyone done this before?
Regards,
Dave

February 2nd, 2010, 05:31 PM
#2
Re: Upsampling algorithm
What you need to do is upsample 11.025 kHz to the lowest common denominator (*16 = 176.4 KHz), then downsample to 16 kHz.
If you go the oppisite direction, don't forget to run a FIR on the result.
Erik
P.S. You may have to upsample to a higher value (*5) since 11.025 is not a whole number.
Last edited by egawtry; February 2nd, 2010 at 05:34 PM.

February 4th, 2010, 09:04 AM
#3
Re: Upsampling algorithm
I see, I am not a proficient coder however, and am having trouble writing the actual interpolation algorithm.
I could also upsample 11025 by 4x to 44100, interpolate to 48000, then downsample by 3x to get 16000, I am just having trouble with the actual coding of the interpolation part.
It needs to eventually be in C++, but I'm currently working in Matlab (similar to C, C++).

February 4th, 2010, 10:46 AM
#4
Re: Upsampling algorithm
Originally Posted by dosilegecko
I could also upsample 11025 by 4x to 44100, interpolate to 48000, then downsample by 3x to get 16000, I am just having trouble with the actual coding of the interpolation part.
Isn't that the same as the original problem?
There is a mathmatical way of doing this, but I don't really have the time to figure it out.
1. Allocate an array 640X the length of your input. (7056K samples)
2. Copy in the 11.025KHz signal, each Hz put in 640 samples.
3. Read a Hz every 441 samples.
You can reduce this by playing with the numbers a bit. You can put a counter in and offset the sample by 1 every third read if you divide by 3, for instance.
If you are into DSP, you can interpolate it to your 44100 by padding with zeros, then use a FIR to reduce it to 16KHz.
Erik
Last edited by egawtry; February 4th, 2010 at 10:51 AM.

February 4th, 2010, 11:14 AM
#5
Re: Upsampling algorithm
Thank you, that works just fine. I avoided interpolation this way by simply upthendown converting.
I may work on the implementation using interpolation in case upsampling by 640 and downsampling by 441 is too many operations.
Tags for this Thread
Posting Permissions
 You may not post new threads
 You may not post replies
 You may not post attachments
 You may not edit your posts

Forum Rules

Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!
