In the case with a 1-D input like audio, how can a system with one input do many different kinds of processing at different sampling rates and still, at the end of the processing, produce one waveform? For example an ADC/DAC reading and writing at 48kHz, but has an FFT running at 8kHz or another set of processes running at 16 kHz? Is it a matter of decimating and interpolating? How would all of these processes line up?
2 Answers
You are on the right track. You can use decimation and interpolation (or resampling, which is a combination of both decimation and interpolation) to change the sample rate. For instance, if you start with 48 kHz samples you can decimate by 6 to get down to 8 kHz, do some processing, then interpolate by 2 to get to 16 kHz, do some processing, then interpolate by 3 to get back to 48 kHz.
"Lining up the processes" is not in and of itself difficult. You can decimate and interpolate whenever you want. Doing it in a way that makes sense and is useful, on the other hand, requires knowing more about what you start out with and what you want to accomplish.
-
$\begingroup$ Thanks. To illustrate my confusion, imagine I have audio at 48khz, but i want to apply one filter at 8kHz and another filter at 16kHz. Thats 6 sample periods for the first filter and 3 sample periods for the second. Every 1/48kHz, the DAC is reading out a sample, what does it read out in the interim? Am I thinking about this correctly? $\endgroup$– panthyonCommented May 21, 2015 at 23:32
-
2$\begingroup$ @AnthonyParks: Think of it this way: your ADC is continually spewing out samples at 48 kHz. This might feed a decimator that reduces the input sample rate by 3 (to 16 kHz). The output of the decimator feeds your 16 kHz filter. That feeds a decimator that reduces the sample rate by 2, which then feeds your 8 kHz filter. Data continually streams through the system; for every 6 samples in from the ADC, 1 sample comes out at the end of the chain. $\endgroup$– Jason RCommented May 22, 2015 at 11:26
-
2$\begingroup$ @AnthonyParks: In practice, it's likely that the decimators could actually be combined with the filters you mentioned (since decimation typically requires a lowpass antialiasing filter), but that's an implementation detail. There are entire books written on multirate signal processing; I would recommend the classic text by fred harris. $\endgroup$– Jason RCommented May 22, 2015 at 11:27
If you are running a causal/real-time process, note that any upsampling/downsampling sub-process involves anti-alias filtering that will add a delay (a linear delay in the case of a symmetric FIR filter).
So, if you want to re-combine resampled and non-resampled processing chains, you might want to add delays to the non-resampled processing paths to match the anti-alias filter (and other) delays in the resampled processing paths to "line things up", depending on what you are doing, of course.