CIRRUS LOGIC AUDIO CARD FOR RASPBERRY PI COMPUTER Audio Pi Cirrus Logic recently introduced a new audio board for the Raspberry Pi educational computer. Price just £25! You can listen and record hi-res digital, so Noel Keywood did...
The Cirrus Logic audio card for the Raspberry Pi computer is, quite simply, monstrously complex in underlying structure and beyond easy description. I will keep this review short and sweet and non-technical, so you get the hang of what it can do from a high-fidelity perspective – and whether it may suit you or your son/daughter, bearing in mind Raspberry Pi is an educational computer that has sold 4 million units around the world to date – and is probably better known to those under 20 years old than those over it. The Cirrus Logic audio card we reviewed (Version A1.01) is relatively new, taking over from a Wolfson predecessor and sent to us by element14 of the UK, who produce it, so it’s recent and representative. My 15-year-old son Douglas was given the task of getting this new Raspberry Pi 2 Model B up and running since he is part of its target educational audience, knew about it and has a view. You can read his experiences and views separately HERE. This tiny audio card, price £25, will play digital music files stored in Raspberry Pi’s microSD card memory, using a music player bundled with the Cirrus Logic audio card drivers named LXmusic. Both analogue and digital outputs are available to drive headphones or hi-fi. We are talking about being able to play top quality, high-resolution digital audio files here (24/192): the board is a full blown hi-fi product, not just a geeky MP3 player. But that is far from all – this little board will also record analogue audio to a digital file directly, since it possesses internal analogue-to-digital convertors (ADCs) as well – and that means it can record LP, radio or anything else – even speech. It can record digital direct too, through a normal (phono socket) electrical S/PDIF input. And there’s even more. Two on-board miniature (MEMS) microphones enable it to record stereo sound direct, and a tiny on-board Class D 1.4 Watt per channel power amplifier can drive loudspeakers. Awesome at the price! The card has three major silicon chips on-board, the key item being a Wolfson WM5102 audio Codec (coder/decoder). It is a fiercely complicated chip designed for mobile phones, tablets, what have you. The remaining two chips are a WM8804 S/PDIF transmitter and receiver, showing that digital audio connectivity has been taken seriously, and a WM7220 digital microphone module. The WM5102 audio codec possesses no fewer than six ADCs and seven DACs on-board, all with a respectable hi-fi specification, even though this is a mobile ‘phone chip. The 24bit resolution DACs have a quoted 113dB range – better than CD’s 102dB – and they met this under test. The 24bit ADCs have 96dB range. There is a Digital Signal Processor (DSP) to handle audio manipulation, and standard sample rates quoted are 4kHz up to 192kHz. The two Class D loudspeaker power amplifiers need their own 5V, 2A power supply – if they are used. This explains the audio board’s d.c. input socket. You must also solder in loudspeaker connecting pins, so some DIY is involved – plus the ability to use a small 15W soldering iron, steady hands etc! BOARD INSTALLATION Our board came in a small unprepossessing cardboard box, together with two support pillars and nylon attachment screws. It’s multi-pin connector is a simple push fit onto a matching connector on the Raspberry Pi board. Easy and trouble free – no soldering is needed. Software for the board, including music player and audio drivers, must be installed. This isn’t quite so easy; see our accompanying article on the Raspberry Pi computer; Douglas wasn’t always so happy about difficulties here! You have to be aware that you must save an image that is bootable, meaning it must be seen directly by the bios – and not a file buried in a file tree structure. Audio input and output sockets are all fitted: phono sockets and 3.5mm stereo jacks.
On the underside lies a long black connecting block that simply plugs into the Raspberry Pi board.
BOARD SET UP The WM5102 uses a bus switching system known as ALSA, to route audio and change volume – explaining the need for users to programme the WM5102 chip via terminal commands made through Raspberry Pi’s terminal function, LXTerminal on the desktop. Terminal commands are, in consumer computing, Neolithic. You write in code on the screen to get the computer to do something. It isn’t easy, convenient or fast, so it was dropped eons ago in favour of icons that invoke pre-written code. So these days we point at a picture or word (Save, Record etc) and the underlying code runs. But this board goes back to terminal work. It isn’t the end of the world but you do need a bit of patience, a keen eye to ensure you entered Lineout and not LineOut, for example, and a list of commands either written down or stored in your head. Terminal commands also set various parameters such as record sample rate, etc. – and this is where life gets a little taxing, since some of the commands are arcane (weirdly written) and lengthy. However, they are set-up commands used occasionally, whereas the LXmusic player that will see regular use is, thankfully, not command line driven, but works from screen icons just like iTunes etc. – easier, faster and error free. A difficulty with LXmusic player is that if you wish to play, say, MP3 you must download an MP3 decoder that may or may not be free (MP3 is a proprietary compression algorithm developed by the Fraunhofer Institute, Germany). Our LXmusic player only worked with stereo FLAC files by default, but we were happy to work in FLAC. It does not recognise single-channel mono files either, but these are rare so it isn’t a big issue. There is more about the audio board’s file compatibility on the forums, but be aware that comments predating 2015 may not be relevant to the Rasperian OS, board software and LXmusic player reviewed here, which are the latest 2015 iterations. See especially ragnar.jensen on http://www.element14.com/community/thread/42202/l/cirrus-logic-audio-card-working-on-the-raspberry-pi-2. A graphic set up programme called Jack comes bundled in the software to aid set up but ours would not function and wasn’t needed in any case.
PROGRAMMING Here’s an example of how command line drive of the audio board works. If, for example, you need to switch audio out through the black Headset socket (3.5mm stereo jack) mounted on the board to listen to music over headphones, you must bring up LXTerminal on the monitor screen by clicking on its icon, then type in:
./Playback_to_Headset.sh
Note in particular here that commands (shell scripts) are prefaced by ./ and that upper and lower cases (Capitals, non-Capitals) are recognised and important. With command lines all characters must be correct or an error message is returned – a frustration. Get the command right, however, and down the screen spews a long command set, including conditions that can be changed – if you know how! What you need to know here, but is lacking from the User Manual, is that the board uses an ALSA mixer and you are in fact programming this item (amixer, arecord etc) when setting up the sound card. This is important when Googling questions, as Cirrus Logic advise for seeking help in the forums. Commands are cumulative, so if you select Headset then Line Out you get both. If you want to switch one off, a Clear command must be used and new conditions re-programmed. It is tedious and taxing, but it works fine once you get the hang of it. Of course it does mean that to use the music player you must have Pi hooked up to a screen and connected to keyboard and mouse. Set-up conditions are stored and retained after switch off.
The tiny board carries a rank of audio connectors. The yellow phono socket is an S/PDIF digital output, the white an S/PDIF digital input. Around the corner lies a black 3.5mm 'HeadSet' jack socket, a green analogue Line Out and a pink analogue Line In. A 5V d.c. power input socket (black) is at far left.
FUNCTIONALITY What can you do with this board? Here’s a list that we verified through usage. With further programming, more is likely possible.
1) Play back digital music files via headphones It acts as a digital music player, in our case using bundled software LXmusic; other players are available. Our version of LXmusic played only stereo FLAC files, up to 24/192 without any difficulty. Volume is digitally controlled by a slider (softvol).
2) Play back digital music files via Line Out. This is a fixed level 1V maximum output that will feed the hi-fi, through CD or Aux in sockets. Volume is controlled in the hi-fi.
3) Use as external DAC The board can act as a hi-res audio DAC. The S/PDIF input must be selected for this, alongside the Line Output and/or HeadSet output. Digital signals can be fed in from, say, a portable player. Note that there is no USB, nor an optical input.
4) Use with external DAC If you want even better hi-res playback quality then the S/PDIF output can be selected, in order to make an electrical connection to an external DAC from, say, Audiolab, Oppo or Chord, all of whom make DACs with greater dynamic range and even better audio quality.
5) Record analogue from Line In. The input must be selected and then the record file spec etc. It gets complicated, but works well if you have enough card space. Use Ctrl C to stop.
6) Record digital from S/PDIF in. More hanky-panky with user scripts but it works.
7) Record from on-board mics. This is a subject in itself. See the WM5102 Spec Sheet for deep detail on circuitry.
DRIVING LOUDSPEAKERS To drive loudspeakers you need to buy an external 5V, 2A power supply with suitable co-axial plug (5.5mm/2.1mm) with centre pole positive; Maplins have a good, smoothed supply of suitable specs and with the necessary co-axial connector. This PSU will run the whole board; the microUSB power line becomes unnecessary. To get up and running means soldering in connecting pins but we soldered in flying leads with insulated croc-clips. The loudspeaker output must also be selected by a screen command at LXTerminal. The small Class D amps produce a mass of high frequency switching mush that varied with level and distortion values were in the order of 3-13%. Output moved into overload clipping around 3V, or 1 Watt (into 8 Ohms), so these are 1 Watt amps. A low pass output filter is recommended in the WM5102 datasheet to kill mush – see p318. What is not said is that there is no software volume control; output is fixed! To change volume I ran the following script:
amixer $1 -Dhw:sndrpiwsp cset name='Speaker Digital Volume' 126
The number at the end – 126 here – sets gain / volume – hardly user friendly. A script could be recalled by using cursor Up key, then modified, to change volume quickly without a complete re-write. But the commands are arcane and tedious to apply. These little Class Ds are crude so are best not bothered with – hence the lack of connectors etc. LP filters will clear HF mush, but not audio-band mush.
Four through-plated holes, seen at front here, need either pins or wires soldered in to feed loudspeakers. The vertical gold pins are for external connection. CONCLUSION The Cirrus Logic audio board provides excellent sound quality and has a wide range of capabilities – if you can find out how to use them. The problem here is an inconsistent User Manual that omits a lot of important information. A lot better is needed, at least on the element14 website. Instead you are requested to plough through a lot of forum posts to reach an understanding of basic issues, and solve the problems that are inevitable. This appeals to some, but not to most. Our Raspberry Pi and its audio board – in essence – worked well. If you have the time, patience and interest to understand how to set it up and use it, this is a superb little board at an amazingly low price. You will get great sound quality, if with some effort.
For more see... http://www.element14.com/community/community/raspberry-pi/raspberry-pi-accessories/cirrus_logic_audio_card?
CIRRUS LOGIC AUDIO CARD £25
OUTSTANDING - amongst the best
VALUE - keenly priced
VERDICT A sound card for Raspberry Pi that offers excellent sound quality and can record too.
FOR - high res digital sound - records digitally - on-board power amps - very low cost
AGAINST - poor documentation - technically complex - difficult to use
Element14 www.element14.com
MEASURED PERFORMANCE A major issue with this audio board is that it’s very dependent upon the quality of the power supply used to drive it. A noisy 5V switch-mode power supply unit (PSU) resulted in 76dB dynamic range from Line Out, but a quiet one (Apple phone charger) gave an excellent 110dB – an improvement of 34dB gained solely by using a better power supply. More surprisingly, this also cleaned up the digital S/PDIF output to a Chord 2Qute external DAC, allowing it deliver the full 121dB dynamic range of which it is capable. A good supply would be a battery of some sort, lead-acid or lithium ion, for top audio results, or a smoothed linear supply, bearing in mind that 5V is needed and batteries deliver 6V. Switch-mode supplies generate rubbish and the audio card is sensitive to this (the Apple charger is switch mode, but clean). See p320 of the WM5102 datasheet for more on this. With a full level 0dB digital playback signal the audio board gave exactly 1V out maximum from HeadSet (black socket) before overload. However, it overloads after the volume control and with a 0dB signal volume had to be reduced a long way to avoid overload and the distortion it generates. Overload such as this would be obvious on headphones and only with insensitive ‘phones would more than 1V be needed so there are no issues here.
The Cirrus Logic audio board with loudspeaker leads soldered in and a suitable Maplins 5V, 2A smoothed power supply connected.
With a -60dB distortion test signal, gain (volume) could be set to maximum and under this condition output measured 37mV, indicating the audio board needs to swing 3.7V rms to deliver full output without overload – not possible from a 5V d.c. power supply without using power line d.c. voltage convertors. At full gain the board’s DAC was able to deliver 0.05% distortion from a 24bit resolution signal – a surprisingly good result, up with that achieved from hi-fi convertors. EIAJ Dynamic Range measured 113dB – also a very good figure, well above CD at 102dB, if not quite up with the hi-fi average of 115dB or top DACs at 122dB. It shows the board’s DACs offer good results, however. With a 192kHz sample rate file, frequency response measured flat to 56kHz (-1dB) our analysis shows, at half volume. Surprisingly, the volume control curtails this a bit at high settings, bringing the upper limit down to 20kHz, but this isn’t going to be easily audible nor a real life setting. So the board exploits 192 hi-res digital well enough. Line Out (green socket) offers a fixed output unaffected by the volume control. Maximum level has been set to 1V to avoid output overload, distortion (24bit) measuring 0.07% at -60dB and EIAJ Dynamic Range 110dB – similar results to HeadSet with volume reduced to give 1V out, so Line Out does not offer better quality, only fixed volume. The digital S/PDIF output was connected to a Chord 2Cute DAC to see if its intrinsic 121dB dynamic range value could be exploited to achieve better quality than the board’s internal DACs. Interestingly, power supply noise made a massive difference here, dynamic range improving from 106dB with a noisy PSU, to a full 121dB through the 2Cute with a good PSU. So using an external DAC connected to S/PDIF out does offer better quality than the internal DACs. However, only DACs from Chord, ESS (Sabre32 9018) and Burr Brown (PCM1765) improve on the audio board’s DACs that, in themselves, offer relatively good results. The volume slider of the LXMusic player, even though it would appear to be digital, does not affect S/PDIF out. Recording via the Line In (pink socket) showed a 1V input was needed for a full level 0dB signal as standard default. However, record gain can be increased by those with the time and inclination to delve into writing a suitable command line script. Recordings at 16/44.1kHz delivered similar quality to CD, with bandwidth to 20kHz and 92dB dynamic range. Our board would only record at 16bit resolution, not 24bit and the WM5102 data sheet alludes to Normal and High Performance modes, but which mode the board uses is unstated. The ADCs are 24bit it seems from the datasheet. The loudspeaker output delivered 3V at 3% distortion and above this output overload (clipping) set in. Frequency response reached 90kHz however, with a 192kHz sample rate signal. We did not use an output LP filter, but one is required the datasheet says (p318) to remove all the switching noise. There was no d.c. offset, differential or to ground. The Cirrus Logic audio board delivered very good results from its on-board DACs, reaching full hi-fi spec. The ADCs worked well too, offering CD quality. Only the small loudspeaker power amplifiers were a bit limited, but that is to be expected considering they are built into a tiny chip and an external low pass filter (22µH/3µF) is needed to clean the output. NK
Frequency response (-1dB) (192kHz) 10Hz-56kHz Distortion 24bit 0dB 0.006% -60dB 0.05% Separation (1kHz) 110dB Noise (IEC A) 110dB Dynamic range 113dB Output 1V
FREQUENCY RESPONSE
DISTORTION
|