An Audio Sample Rate Converter attempts to change the sampling rate of a signal without destroying the relevant signal information. Generally, one wants to reduce the sampling rate of an audio signal to reduce the computational burden of required digital signal processing algorithms. Since upsampling relies on interpolation, it is not suitable to introducing fidelity into audio signals. Instead, it is useful in multi-rate systems to keep the input and output sampling rates equal, or to achieve rational number changes in the sampling rate.
Sample Rate Conversion Algorithm
A sample rate conversion algorithm generally has three major components: a decimator, an interpolator, and filters that accompany those processes. The keys to performing audio sample rate conversion are a good filter design algorithm and an efficient implementation structure. For instance, a poor implementation structure is to use a direct form FIR structure to filter the fullband signal before doing decimation. While conceptually simple and elegant, a better solution is to first decimate and then filter. This reverse structure is called a noble identity, and results in significant computational savings over the direct approach.
Of course, that is not the last word on efficiency, or elegance. In the polyphase commutator structure, the filter is split into several sub-filters by decimation, and the ith sample is multiplexed to the ith sub-filter. In this manner, the structure is not throwing away any information because all samples are being used, but is at the same time resulting in significantly shorter tap lengths. As the number of sub-filters grows, however, there will be threading and other implementation issues that start becoming real problems.
Even if an audio sample rate converter has an efficient structure, a poorly designed filter can ruin the output. A good filter is short, with fat pass and stopband ripples, along with a sharp transition band. The definition of short and fat of course depends on the implementation. For audio sample rate conversion, however, downsampling needs to preserve fidelity over the band of interest and upsampling needs to prevent aliasing. One method for short filter design is the Parks-McClellan Remez exchange algorithm.
The exchange algorithm produces the Chebyshev solution to the filter design problem. That is, it produces a filter whose maximum absolute deviation from ideal is minimized for a given filter length. Typically, modern filter design algorithms are written in double precision floating point, and finally quantized to the required register size at the very end. This approach leads to what are called quantization errors that can accumulate and severely degrade the performance of the implemented fixed point filter relative to its designed floating point counterpart, if not break it entirely. Luckily, such errors can be well tested out and the appropriate register size can be chosen to minimize or eliminate them entirely.