[sdiy] Digital interpolation filtering

Tom Wiltshire tom at electricdruid.net
Sat May 30 16:29:48 CEST 2009

Hi All,

Following on from my query about getting two dsPICs talking to each  
other, it looks like I'm going to use the codec interface to send six  
channels of modulation data from one chip to the other. I'll probably  
use the audio uP as the master running at 62.5KHz, and request one  
modulation channel's data per sample.
1st audio sample, mod ch1 sample 1
2nd audio sample, mod ch2 sample 1
3rd audio sample, mod ch3 sample 1
4th audio sample, mod ch4 sample 1
5th audio sample, mod ch5 sample 1
6th audio sample, mod ch6 sample 1
7th audio sample, mod ch1 sample 2
8th audio sample, mod ch2 sample 2
9th audio sample, mod ch3 sample 2
etc etc

Now, I'm wondering if I can't use a simple digital interpolation  
filter to fill in the missing samples for each modulation channel -  
upsample the modulation to 62.5KHz.
I'm having a go at getting my head around this on my computer before  
I go anywhere near any assembly language. Upsampling isn't that  
processor intensive, since most of the samples are zeros (all the  
ones inbetween) and can therefore be ignored. A filter of 31 taps  
only actually gets 6 genuine samples (max), so only 6 MACs are  
required to calculate the whole filter. This kind of efficiency seems  
too good to miss.

I've never done digital filtering before though, and I've got some  

Am I better off with an odd or even number of taps? Odd seems more  
logical somehow, since there is a "middle" sample, but I'm really  
just going on a gut feeling.

What's the value of the sinc function at zero? sin(x)/x is a division  
by zero so doesn't give a sensible value, and I never saw a filter  
that could handle a coefficient of infinity. How do people cope with  

Are there are any good tools or tutorials for this stuff? I'm looking  
for something really practical and implementation based. Equations  
with complex numbers in are no use to me yet, even if they are the  
underlying theory.

How do I work out what the hell the cutoff of the filter is from the  
coefficients? I've got two variables in the code that builds the  
coefficients. One controls the frequency (width) of the raised cosine  
window, and the other controls the frequency of the sinc function (eg  

Any clues, pointers or ideas appreciated. I'm well out of my depth here!

Tom (not waving, but drowning!)

More information about the Synth-diy mailing list