Sample Rate Converters (SRC) are used for changing the sampling rate (or frequency) of any signal. This include upsampling - increase the sampling rate or downsampling - the process of decreasing the sampling rate.
The upsampling process involves adding extra samples in between the existing samples (aka interpolation). A good example could be digital zoom in of an image. Downsampling on other hand is the process of removing samples (aka decimation), thus creating a signal with fewer samples, like zoom out of an image. My discussion here would narrow down on audio signal however similar approach could be used for images as well. I will discuss about SRC w.r.t images on some other day.
The below figure shows an original signal (a) and its downsampled version (b). The exact opposite is true for upsampling.
There are various applications of SRC in audio. A classical example could be conversion from audio on Compact Disc (44.1KHz) to Digital Audio Tape (48 KHz). Also it could be used while mixing multiple audio streams, or while rendering to a speaker which supports a different playback sampling rate, than the incoming audio. SRC usually a processor intensive algorithm and hence care must taken while choosing one.
Now lets discuss about various algorithms to achieve the same. Few of the approaches are:
1. By adding zeros in between samples and followed by a low pass filter to remove unwanted frequencies generated. For example to interpolate by L, one need to add L - 1 zeros between the samples. For decimation by M involves removing M - 1 samples in between. This method could also be used for fractional resampling as well (L = 1.0884 etc). Few optimization methods involves using polyphase FIR filters for filtering. For certain sampling rate, it could be a combination of L and M.
2. By windowed sinc interpolation method Band limited signals (sampled according to Nyquist criteria) . A good reference could be found in [1]. This makes use to sampling theorem for reconstructing an analog signal from a digital signal. Analog signal could be thought of signal with infinite interpolation. In this method a sinc function is interpolated depending upon minimum of source and target frequencies. This method is a trade-off between quality versus computation time. A detailed discussion will be followed with sample MATLAB code soon.
Few of the open source code available:
1. CCRMA - Bandlimited Interpolation.
2. Secret Rabbit Code - A GPL code for windowed sinc interpolation approach.
3. SSRC - A frequency domain approach.
One could find similar implementations SRC in various audio frameworks like SoX, Avisynth, ffmpeg etc.
As a last note, you can find a good comparisons tool for comparing between various open and commercially available SRCs here [2].
Next time we will be discussing more in-depth of bandlimited interpolation with a MATLAB source code. Till then keep Hac-king...
No comments:
Post a Comment