Transfering audio data between two DSP’s, clock sync problem

audiodspsampling

I have a system with two DSP modules. The audio is routed from DSP1 to DSP2 and then back to DSP1, which in turn immediately sends it to DAC. It's a high-quality stereo sound at 44.1KHz.

This is a requirement, there should be two DSPs and routing can't be changed.

The problem is the clocks. Each DSP module has its own internal clock, which can't be ideally synchronised. I set the rate numerically on both, but the result is that I get a slightly glitchy sound, for obvious reasons.

One solution would be, of course, to feed the clock from one DSP to the other, but at this time this is a bit problematic for me.

Is there another way around this? E.g. a relatively simple algorithm that can compensate little differences between clocks? Any other ideas?

Edit: the connection between the DSPs is I2S. Either module can operate in master mode, but it doesn't help.

Best Answer

If both DSPs cannot be slaved to the same oscillator for some reason you must use sample rate conversion. This is because after awhile, you inevitably will have 1 more or 1 fewer sample due to slightly mismatched clock rates. You can use simple interpolation, or more complex sinc based SRC methods for much better audio performance (see this paper for example). Alternatively, it is typically possible for the audio clock (for example, a I2S or AC97 clock) to be asynchronous from the DSP's internal processing clock, but this will largely depend on if the DSP has internal hardware to cross that clock domain (basically, it needs a dual clock FIFO). Some DSPs designed for audio (for example, the Analog Devices SHARC series) will have built in sample rate conversion modules for this exact purpose.