Subject: Re: Ensoniq AudioPCI 97
To: Brett Lymn <>
From: Lennart Augustsson <>
List: current-users
Date: 09/05/1999 09:44:57
Brett Lymn wrote:

> According to Lennart Augustsson:
> >
> >So I had a look at how to do sample rate conversion.  Basically all you do
> >is to form the convolution of the input signal and the sinc function for
> >each sample you want.
> Ugh, that sounds very heavy on the math.

Well, for CD quality sound it seems to be about 25 multiply-adds per output

>  Depending on the direction
> you are doing the conversion (i.e. oversampling or undersampling) then
> there are some quick tricks you can pull.  To increase the sample rate
> by n you first filter the input to cut off anything above
> (sample_rate/n) and then replicate each sample n times - if you want
> to get snazzy you can use a linear interpolation to generate samples
> if you are increasing the sample rate significantly.  To decrease the
> sample rate (decimate) you first filter to remove components greater
> than the target sample frequency and then simply throw away 1 in n
> samples.

If I understand what's happening with the convolution it does exactly
low pass filtering.  So for oversampling you start by just treating the
input signal as it was an analog signal, then resample it at the new rate,
and finally filter away anything above the (original) Nyquist frequency.
For undersampling you start by filtering away anything above the (new)
Nyquist frequency and then resample.
This is my intuitive understanding of what the convolution does.

> >  Then you have to make tradeoffs for this
> >to be computationally feasible, of course.  Even so, you need a fair number
> >of multiply-adds per sample to produce, I'm afraid.  At least if you
> >want good quality.
> >
> You will need some multiply-adds but if you use a decent filter say,
> a 2-pole elliptical, you can get a decent roll off with only a small
> computational overhead.

Well, that's the key point, isn't it?  To get a good filter and fast filter.
I'm very open to suggestions on how to do it.

> Brett"Yeah, I used to work on sonar processing software, how can you tell?"Lymn

Hey, why am I trying to do this when we have a professional here? :-)
If you write the conversion code I'll adapt it for the audio driver.


        -- Lennart