View Single Post
  #4 (permalink)  
Old 10-21-2008, 04:03 PM
[email protected]
Guest
 
Posts: n/a
Default Re: Sample rate conversion, Multistage and polyphase?

On Oct 20, 7:10*pm, "baeksan" <breakcha...@yahoo.com> wrote:
> >Think about writing a function that is a simple interpolator/
> >decimator. For example a 3:2 interpolator/decimator program would
> >interpolate by a factor of three and then decimate by a factor of two.
> >The trick is to count through the phases and know where the zeros are,
> >so you won't waste time computing with zeroes. Once you have such a
> >routine written then you can simply cascade multiples of these with
> >different/similar interpolation/decimation ratios to arrive at
> >essentially any rational transformation you need. The other part is to
> >design your FIR filter knowing where the overlap and don't car regions
> >fall. *I did this years ago and it worked quite well. I even had the
> >code take the impulse response and break it up into its various
> >phases.

>
> >IHTH,

>
> >Clay

>
> Clay,
>
> Thanks for your reply. *The problem I am having is that doing cascades
> seems to take more cpu than just doing one stage, I think due to looping
> through each sample multiple times. *For example, doing the following
> multistage cascade, 2:1, then 80:147, seems to take more cpu than just
> doing 160:147 sample rate conversion? *Is there a way to do the multistages
> on one function call, not having to iterate through each sample multiple
> times?- Hide quoted text -
>
> - Show quoted text -



I think a three or four stage approach would be your best bet for a
44.1 to 48 conversion. Euclid's method reduces this to 160:147
(reversed order to state as interpolation/decimation ratio) as you
already know. And then prime factoring these gives (2*2*2*2*2*5):
(3*7*7). So you could try (3:2),(7:4),(7:4), and finally (1/5) for a
possible set of interpolation/decimation ratios. Hopefully you are
only trying to keep something like 0-20kHz and not get close to
22.05kHz.

Also when you design your filter (only one for each interpolator/
decimator stage), you know that the filter isn't designed as a strict
lowpass filter. The folding over of the spectra creates don't care
regions. So by not forcing your lowpass filter to specifically stop
everything above a certain frequency but rather have it just stop
certain bands (ones that map on top of the desired passband) above a
critical frequency, will allow your filter to have fewer taps and
therefore save resources.

Also The cascade structure basically has you call the output put stage
which in turn calls the stage before it as necessary to feed it. The
input stage will request input data from the source as needed. As I
stated before I've used this approach quite sucessfully for converting
various rates common in computer audio.

The motivation behind the factoring of the ratios into ones with small
prime numbers is high interpolation and decimation ratios force sharp
transitions in the interpolation filter's response which makes for
very long (high numberof taps) filters. So the primes allow you to use
the lowest possible ratios.

IHTH,

Clay


p.s. Maybe I need to write a paper giving the details of this approach
along with c code actually implementing it. I already have the code
written.






Reply With Quote