Audio – IP interface board

Embed developed an Audio over IP interface board. During this development Embed encountered several challenges.  Embed accepted these challenges and it resulted in a prototype.

The board

Embed had to interface a great amount of remote inputs en outputs over IP. It had to be able to play audio. Furthermore Embed wanted to be able to stream several (up to 25) devices simultaneously. 100mbit Ethernet is useful in such a setting. Ethernet at 100mbit offers more than enough bandwidth for this task.

As a setup Embed used PureData to stream audio from a PC to the devices. PureData controles the raw audio using UDP-packages with a sample rate of 44100Hz to the device. The imaging was done on a PIC32 that ran on 80Mhz.

Play and receive audio

The first challenge Embed encountered during this project, was that the buffer had to be able to play audio and receive audio at the same time. The buffer had to be big enough to handle packet loss in the incoming data packets.

Sample clock

The second development that Embed encountered was that the PC’s sample clock (44100Hz) didn’t correspond to the playback clock of the device. This causes exceeding of the buffers of the device when the PC’s clock is faster. On the other hand this causes a buffer which is too empty when the clock of the PC is slower than the playback clock of the device. Both an empty buffer as exceeding of the buffer lead to disturbances in the playing sound.

Solution

Embed accepted the challenges by adding a dynamic re-sampling routine to the device. When the buffer gets full, some samples are thrown away.  Actually the sample rate of the incoming signal is reduced. When the buffer gets empty, samples are added by using interpolation. The effect of this solution is that the sampling frequency of the incoming signal is increased. To make the dynamic re-sampling work properly, the sample rate of the incoming data must be estimated. The firmware keeps a sample rate estimate, which it increases once the buffer fills to a certain level. The estimate is lowered when the buffer reaches a low ‘water level’.

Audible adjustments

For the engineers of Embed it was interesting to listen to the effects of the different water levels and estimated adaptation rates. Some settings caused the sample rate estimate to oscillate more than 5Hz. This was audible to the engineer when a sine wave was played! By choosing the right values, Embed developed a very stable playback algorithm, without audible artifacts