Asynchronous Sample Rate Conversion (ASRC) for Matlab


I prefer the term Arbitrary as opposed to Asynchronous for situations where the sample rate clock(s) physically doesn't exist (such as a Matlab simulation) but asynchronous is the more accepted term and I succumb to that for the title. In the sequel I favor arbitrary.

I needed a block sample rate converter in Matlab but didn't find anything conveniently available at least in my version of Matlab (R11) and toolboxes (Signal Processing Toolbox only) so I created these. Consequently, these are written for Matlab R11.

Two methods are presented. The first is the well known Farrow method. The second is a clever Lagrange interpolation method by C. Candan described in his paper which might be available here or see the code or in Matlab type "help asrc_lagrange" for the IEEE reference. The computational cost of the Candan algorithm is on the order of an ordinary FIR.


Introduction

Arbitrary sample rate conversion consists of two steps:

  1. Computing the position of the desired ouput sample relative to the input samples. Since sequences are integer indexed this can be thougt of as a floating point sample time where the integer portion refers to the input sample position and the fractional part refers to the distance between that sample and the next.
  2. Computing the ouput sample given the inputs and the position calculated in 1.
In Matlab the desire in general is to work with vectors so the goal is to generate a vector of resampled outputs from a vector of inputs. The position of the first output sample is in general arbitrary. However, it may not be possible to store the entire input sequence at once and if so a segmented approach is necessary in which case the next segment needs to 'start' where the previous one 'left off'. A convenient way to think of this is to generate the output sample times as an initial time t0 plus time steps of dt where dt is the ratio of the input to output sample rates (Fsi/Fso).

To simplify the boundary conditions, in the Matlab code the maximum number of output samples are always generated from the input samples. Because of the initial offset t0 and the resampling ratio dt the number of output samples for a given length input can vary and it may not be possible to get exactly the number of desired outputs (i.e for block processing) by controlling the number of given inputs. In the case where a fixed output block size is needed, the input size can be controlled to produce at least the number of desired outputs and any extra have to be saved for the next block. In this situation, this has to be managed outside the provided functions but a corresponding testbench block_test.m is included.

The interface to both the Farrow and Lagrange sample rate converters are similar so it is easy to go between them. For more information see the Matlab code and refer to the testbenches.


Farrow Method

The Farrow method files are available here.

Three functions are provided:

The following testbenches are provided: Additional testbenches are included with the Lagrange method which are easily adapted to the Farrow method.


Lagrange Method

The Lagrange method files are available here.

As mentioned above, the algorithm used is slightly modified from that proposed by Candan and pictured here.

One functions is provided:

The following testbenches are provided:


Return to Matt's World

Hosted by www.Geocities.ws

1