Just a quick note on sample rate conversion as my previous job involved plenty of this...

Converting from one sample rate to another integer multiple/divisor of that rate is relatively straightforward. To convert upwards, simply stuff zero samples between the samples you have and apply a low pass filter to fill in the gaps. To go the other way, you need to filter first, then throw away some of the samples.

This is trivial compared to what you have to do to convert between unrelated rates, eg. 44.1kHz to 96kHz. I'll give a couple of examples:

Take a 10ms snippet of music (ie. 0.01 seconds). This gives us nice round figures to use...

10ms at 44.1kHz is 441 samples.
10ms at 88.2kHz is 882 samples.
10ms at 96.0kHz is 960 samples.

Converting from 44.1 to 88.2 is fairly straightforward, as every even sample in the output corresponds exactly in time to a sample in the input. Another way of looking at it is that we only have to fabricate 1 sample for every two that we output.

Converting from 44.1 to 96 is horrendous. Take a piece of paper and mark out 441 points, spaced regularly. Below these marks, add 960 points, spaced regularly, OVER THE SAME DISTANCE. This piece of paper represents our 10ms snippet.

Look at the relationship between the input samples (the 441 points) and the output samples (the 960 points). You will see that the distance between a point on the 960 line and its nearest neighbours on the 441 line keeps changing.

What happens when we want to generate the 960 line from the 441 line? Well, we could copy samples from the 441 line if they are close to the required 960 point, filling the rest with zeros and doing the low pass filter (as we would to convert to 882), but you will see that the gaps between real samples is uneven, horribly uneven. This unevenness is known to us all as jitter. The sound would be terrible.

So, what we must do is implement a low pass filter that takes into account the relative distances from the required output sample to a number of input samples. In fact, we need a completely different filter for each distance. We noticed how the distances between the samples keeps changing, each change requires a new filter. In the worst case, we need 960 separate low pass filters (the problem is symmetrical, so we only really need 480). The sound quality of the output is directly related to the number of coefficients in each filter (say at least 40).

So, where are we? We have 480 filters of 40 coefficients each, that's 19200 coefficients we need to store somewhere, we also have to select the correct filter out of these 480, on top of all that, we need to do the DSP to actually implement the filter.

Bear in mind the fact that the product has many many other things to do as well. Also bear in mind that each of the 480 different filters will sound slightly different. Also bear in mind that buffer management is complete hell when your input and outputs are at unrelated rates. Also bear in mind that locking two unrelated clocks is difficult and jittery at best.

Believe me, you don't want to the processor to convert 44.1kHz to 96kHz.

I know I began with "just a quick note." I could have got into detail.


Forever yours,

Simon.