Getting Hi-Fi sound from Raspberry Pi

Raspberry Pi, the low-cost credit-card-sized educational computer, is finding its way into high-end home audio systems.The key software is RaspBMC, a media player package based on the XBMC Linux distribution.

Together they offer network media access, remote control, and a whole host of other features usually found only on multi-hundred pound sound systems.There is only one snag: Raspberry Pi’s own analogue audio output is distinctly medium-Fi.Getting Hi-Fi sound from Raspberry Pi

So, Electronics Weekly asked itself, how difficult would it be to design a piggy-back board to add a high-quality audio output to Raspberry Pi.

A little phoning around revealed that more than one chip company has been thinking along the same lines, and by coincidence Wim Lemmers, principal application engineer at NXP, recently acquired three Raspberry Pis for his lab on which to develop Linux drivers for one of the firm’s audio codec chips.

UPDATE – Wolfson has releases a hi-fi audio board for Raspberry Pi

“I bought a few Raspberry Pis a few weeks ago,” said Lemmers. “Revision 2 of the hardware has an extra connector implemented that contains exactly the signals that I require: I2C and I2S.”

I2S is a serial bus specifically defined for communicating digital stereo.

“Using I2S, you can implement any audio codec you like, but it has limitations: I2S can only be used for stereo,” said Lemmers.

Along with a ground connection, it has four wires: audio data in, audio data out, words select, and clock.

There is no data buffering. Audio data in and out are continuous strings of bits, directed and clocked by the other two signals.

For 16bit stereo from a CD (CDs are sampled at 44.1kHz), for example, the clock runs at 16x2x44,100=1.4112MHz.

Word select, in this case, carries an 44.1kHz square wave which indicates whether left or right channel data is being sent at any moment.

I2S is a sub-set of related time division multiplexed (TDM) pulse code modulated (PCM) audio interfaces with the same four wires for one or more channels. In the general case, word select is re-named ‘frame start’ and pulses once to coincide with the first bit of the first channel on a multi-channel bus.

Early audio codecs were simply DACs and only required digital audio. Now codec can be far more sophisticated and their advanced features, like DSP and audio path switching, need controlling.


Scroll to Top
Read previous post:
Video: How they make Raspberry Pi in the UK

Electronics Weekly visits the Welsh factory where Farnell/Element 14 gets its Raspberry Pi boards made. Run by Sony near Bridgend...