Testing the Wolfson Audio Board and Raspberry Pi

The trouble with birds is they get up earlier than I do, so a time-delay start recorder lets me scout locations without loads of early starts.Autonomous recorders are sometimes known as frogloggers in the nature recording community. Commercial variants and great, reliable, but dear. I want something I’m prepared to take the risk of losing to some inquisitive dog-walker, and preferably something I can make enough of to scout several locations.

A Raspberry Pi via Wifi is also a good remote startable recorder over WiFi . A bit like the Tascam DR-44WL but without the nice display. the trouble is the Raspberry Pi has no record facilty. If it had, you can start recording by logging in via SSH and issuing the arecord function. The audio can even be transferred off the Pi remotely via SFTP over WiFi. Enter the Wolfson Audio board – a piggyback audio card for the Pi, which takes over all the IO so you aren’t going to be running any other custom hardware on that Pi.

Installing the Wolfson

Physical installation is easy enough, the Wolfson board uses the bizarre approach of connecting to the GPIO using a standard header and the P5 header using a set of pogo pins.[ref]I did have trouble with these once – what happens is you issue the record for x seconds command and in simply sits there and never times out. Then you press the GPIO down again and it comes good… P5 carries the i2c bus  SCL0 and SDA0 pins which control the Wolfson, lose contact on one of those and you aren’t talking to it any more.[/ref] I’d have been easy with soldering an extra set of pins or a header myself and this is probably a reliability hazard, but I’ll run with it for now. Just as well I’m not going to use the badly aligned yellow and white SPDIF sockets, eh?

I started with a Model A running a stock Raspbian image, 2014-06-20-wheezy-raspbian.zip and ignored Wolfson’s recommendation to avoid a USB hub, because I needed that to see what I was doing to set up WiFi.

bizarre use of pogo pins, it's a wonder these make enough contact for the board to work at all!
bizarre use of pogo pins, it’s a wonder these make enough contact for the board to work at all!

No standard Raspberry Pi Drivers for the Wolfson

Unlike other bits of hardware, to run up the Wolfson card you can’t use the stock Raspbian and do an apt-get install some-sort-of-wolfson-driver. You’re in for a world of hurt here.

You either download the SD card image which is recommended by Wolfson. It’s 8Gb and it means 8Gb, and wouldn’t fit on my 8Gb card, because it requires a card with no dead sectors presumably.

Maybe time to compile the drivers myself following this? Nope – life is too short and I do not have the skillz to firefight what goes wrong. And what with the takeover of Wolfson by Cirrus it looks like the drivers are delayed still more. I like the Torygraph’s opener

Wolfson Microelectronics, the struggling Scottish microchip company, has been acquired by its American rival Cirrus Logic for £278m.[…]
Wolfson has become increasingly reliant on a few big customers including BlackBerry, which as seen sales of its smartphones collapse.
The company reported flat revenues of $179m and mounting losses of $13m last year.
Wolfson admitted it had been blindsided by the rate at which consumers were adopting 4G smartphones, which gave Qualcomm an advantage because it had developed an all-in-one 4G microchip that included an audio processor.

Damn. Those drivers aren’t going to happen any time soon, or maybe ever… I then used Ragnar Jensen’s zip described in this post, and the usage instructions here to install it. Which worked for me. I have no real idea how.

Don’t get the Wolfson card if you want playback until there are normal drivers available

My only interest in the card is to record – everyone else seems to want to take advantage of the whizzy playback options. To be honest there are alternatives if you want playback only, and it looks like the product is at risk of getting orphaned, since it is Pi Model A or B Rev 2 only, not B+, and is still driverless. You run the risk of getting stuck on an old version of Raspbian. That doesn’t bother me, as I will only use this for recording and not run anything else exotic on the Pi. If you want to run a media centre then you could start to hate being stuck on older versions of Raspbian.

How does it record, then?

I made the mistake of firing up ALSAmixer after installing, it certainly showed a lot of options and stuff going on which gave me a good feeling that the Wolfson card was present. But it is easier to adopt their installed ‘use cases’ that are installed in /home/pi


then issue

arecord -c 2 -f S16_LE -d 10 -r 44100 record_from_line_in.wav

to record a 10 second stereo track from Line in (that’s the -d 10 seconds, -d3600 would do you an hour, etc)

I experienced random buffer errors every 30s or so. Mindful of Wolfson’s warning about USB hubs I removed the keyboard (which has a hub) though I still used a hub to power the device, and because this was a Model A I had the wifi on the hub, and still took overruns

arecord -c 2 -f S16_LE -d 130 -r 44100 record_from_line_in1.wav
Recording WAVE 'record_from_line_in1.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
overrun!!! (at least 90.703 ms long)
overrun!!! (at least 50.601 ms long)
overrun!!! (at least 15.111 ms long)

Although it looks ghastly here is an MP3 of the original file that I played into the Pi –

and here is the file recorded with the overruns above, converted to MP3

Which doesn’t sound so terrible to me at all. I should still not be such a cheapskate and buy SD cards from ebay, if a Class 6 card is what’s needed for audio 😉

I still got overruns with FLAC but they were shorter, which points towards disk IO as being the problem, since FLAC ups CPU load a lot but reduces disk writing, because that’s its job

arecord -c 2 -f S16_LE -d 130 -r 44100 | flac -o test1.flac - --channels=2 --sample-rate=44100 -f

flac 1.2.1, Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007  Josh Coalson
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
-: 23% complete, ratio=0.468overrun!!! (at least 20.023 ms long)
-: 69% complete, ratio=0.513overrun!!! (at least 0.553 ms long)
-: wrote 11620131 bytes, ratio=0.507

Using FLAC (free lossless audio compression)

you must apt-get install flac

to get the codec first

Pipe the output of the record chain into FLAC to reduce file sizes by about 40% on field recordings

 arecord -c 2 -f S16_LE -d 130 -r 44100 | flac -o test.flac - --channels=2 --sample-rate=44100 -f

flac 1.2.1, Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007  Josh Coalson
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
-: wrote 11692886 bytes, ratio=0.510

with the flac command the single – means  process stdin and -f means overwrite existing file

FLAC used to be a resource hog so I thought I’d look at the CPU usage, which seems to run about 12-15% on a stock Raspbian (no overclocking etc)

top - 18:07:28 up  1:54,  2 users,  load average: 0.05, 0.04, 0.05
Tasks:  74 total,   1 running,  73 sleeping,   0 stopped,   0 zombie
%Cpu(s): 12.4 us,  2.3 sy,  0.0 ni, 84.9 id,  0.0 wa,  0.0 hi,  0.3 si,  0.0 st
KiB Mem:    187592 total,   145604 used,    41988 free,    14664 buffers
KiB Swap:   102396 total,        0 used,   102396 free,    98588 cached

 2713 pi        20   0  7488 1380  940 S  12.1  0.7   0:03.71 flac
 2710 pi        20   0  4672 1372 1036 R   1.0  0.7   0:00.50 top
 2676 root      20   0     0    0    0 S   0.7  0.0   0:03.14 kworker/u2:3
   13 root      20   0     0    0    0 S   0.3  0.0   0:00.96 kworker/0:1
 2683 root      20   0     0    0    0 S   0.3  0.0   0:01.61 kworker/u2:0
 2695 pi        20   0  9260 1584 1000 S   0.3  0.8   0:00.12 sshd
 2711 root      20   0     0    0    0 S   0.3  0.0   0:00.18 kworker/u2:1
 2712 pi        20   0  4944 1336 1128 S   0.3  0.7   0:00.19 arecord
    1 root      20   0  2148  720  616 S   0.0  0.4   0:04.29 init
    2 root      20   0     0    0    0 S   0.0  0.0   0:00.00 kthreadd
    3 root      20   0     0    0    0 S   0.0  0.0   0:00.46 ksoftirqd/0
    5 root       0 -20     0    0    0 S   0.0  0.0   0:00.00 kworker/0:0H
    7 root      20   0     0    0    0 S   0.0  0.0   0:00.75 rcu_preempt
    8 root      20   0     0    0    0 S   0.0  0.0   0:00.00 rcu_bh
    9 root      20   0     0    0    0 S   0.0  0.0   0:00.00 rcu_sched
   10 root       0 -20     0    0    0 S   0.0  0.0   0:00.00 khelper
   11 root      20   0     0    0    0 S   0.0  0.0   0:00.00 kdevtmpfs

Wolfson Card Analogue Line-up

So it’s time to line the card up and find out what analogue levels it takes. I’m going to need outboard audio processing anyway to bring mic level up to line level, and to be honest that’s probably better done off the board anyway away from all the digital power-supply sizzle. I can control levels in the analogue domain, so no need ot run alsamixer unless I want to do remote live recording.

I injected 1kHz tone from a Farnell Wien bridge oscillator ad found that the default gain setting is exactly right for a 1V rms input

1V rms exactly...
1V rms exactly…
on a scope, not the readout is 10x too low because I used a 10x probe
on a scope, not the readout is 10x too low because I used a 10x probe, so that’s 2.8V p-p or 1.4V peak

When I ftp the file to my PC and look at it with a WAV player I see it is as close to 0dBFS as you can get

You aren't going to get closer to 0dBFS than this without clipping
You aren’t going to get closer to 0dBFS than this without clipping

The audio doesn’t start recording instantly, there is an elegant fade in combined with an inelegant DC shift

Audio fades in softly over a short period
Audio fades in softly over a short period

It isn’t a big deal, but you probably want to start it .1s before the desired sound. That’s neither here nor there with a manual start but if auto-started from a sensor trigger that would be a bear.

Audio performance

I terminated both inputs with 150 ohms and used Audition to gather the stats on silence, starting 3s in, a reasonable way past the initial DC bump.

internal noise stats. I'm not going to complain about this
internal noise stats. I’m not going to complain about this

I then scanned the spectrum of the quiet recording to look for any frequency spurs etc, on a fairly narrow IF bandwidth (wide scanning window). I’m not going to argue with the results –

Can't really argue with that
Can’t really argue with that

For reference here is the 1kHz tone (if you analyse it all the distortion comes from my 1970s era Wien Bridge oscillator)

and here is the quiet recording

I didn’t run rightmark on it since I don’t have anything good enough to generate the test signal and don’t know how to play and record at the same time on the Pi.

Since I want this for recording I didn’t bother to test playback – here’s a description of replay.

Time delay recording

The way to use this as a time delay recorder is to set cron to start on boot:

shutdown -h -t 3700


arecord -c 2 -f S16_LE -d 3600 -r 44100 record_from_line_in.wav

Then power on the Pi and the microphone preamplifier about half an hour before dawn and pull the power after about an hour and a quarter – the Pi should have halted by then. I will use a PIC microcontroller for that job, because it draws a very low power in the rest state, but an Arduino would work too, though it’s typically 7mA drain is higher than it has to be.


The Wolfson audio card records well, with low noise. You need to use a fast SD card otherwise you will get overruns. But it is poorly supported and the devil’s own job to get going. However, it seems the only game in town for high-quality recording.

Since that’s what I want to go I have to put up with the poor support and idiosyncrasies, it works well enough.


16 thoughts on “Testing the Wolfson Audio Board and Raspberry Pi”

  1. Hei Richard,

    Thank you very much for your post. I find it really helpful and informative.
    I installed the OS image(2014-01-07-wheezy-raspbianW.zip) and the media player.
    I didn’t follow anything from here because I thought 2014-01-07-wheezy-raspbianW.zip has everything necessary except the media player.
    When I recorded by using the use cases, I could record but it was silent. The result was same with all different inputs: line-in, headset, and onboard. Did I miss some step in the set up or what is wrong? Thank you!

    1. Hi Seyoung,

      I didn’t go the same way as you did – you followed Wolfson’s recommended path but I didn’t have a 8Gb card big enough to do that.

      Having said that, from what I read about the card you should get the same result – first run the


      which sets up alsamixer

      then issue

      arecord -c 2 -f S16_LE -d 10 -r 44100 record_from_line_in.wav

      after you have applied a signal to line in. If you’re getting nothing then check those pogo pins – I think the instructions to the wolfson card go over those. I had to fiddle with mine to make sure they seated right with the rounded pins matching with the holes. It didn’t work the first time for me, and one of those wasn’t seated right.

  2. Hei Richard thanks a lot for your reply. I think you misunderstood my post. I installed the version Ragnar made, which was 3gb. I solved the issue and it was just like you said: GIPO pin connection problem. I learned that you get better connection when you don’t use screw but just attach the two boards with only pins. Anyway thanks a lot!

  3. Hei Richard,

    What kind of microphone are you using?
    Are you using a DIY elektret mic or commercial mic and a preamp?

    I’ve built my own recording system from an elektret mic and a custom preamp.
    I have three different mics. One is nameless cheap mic(1 euro), another is Panasonic WM61 and Primo EM172. I saw from that you use the same Panasonic mic.
    My preamp is very simple; has two 100nF capacitors, transistor and three capacitors. It’s powered by two AA batteries.

    It picks up the sound but its range is very limited: 15 cm is optimal for speech.
    I manipulated the input gain from Alsamixer but it will also increase noise when I increase the gain….
    I could never get the clean input like you do.

    Any ideas for my situation?

    1. Are you going into the mic input or the line input? All my tests were done with the line input. The default gain is right for 1V RMS which is low for a mic. From an electret mike you’re looking at -45dBFS which sucks because you’ll only be 40dB off the noise floor. Ideally you want about 25dB of gain – you’re pushing your luck with a single transistor to get that. A good old NE5534 or NE5532 or a LM833 will be good here, remember to keep the part of the feedback resistor to ground low (1k or less) else it will screw up the ein of the opamp. Though for 15 cm speech that’s not so critical.

      How are you biasing your electret mic? Two AAs is good for 3V which is enough for the WM61 in theory if you use a 6k8 drain resistor but you’re almost always better off using a bit more, eg a battery box.

      The primo (nice mic from the look of the specs) can get away with 3V if you use a 2.7k drain resistor but it seems a shame to throw away half the output signal by shunting it with such a low value, but that’s what the datasheet says so you should be OK. When you measure the voltage on the mic drain with a DVM it looks like it wants to be at least 2V

      electrets are noisy and low sensitivity when you starve them of power. I’d first measure the voltage on the hot end of mic to see if it’s 2V or more, then investigate if the single transistor amp is working for you – get a scope on it.

      1. Thanks you very much for your kind answer Mr.Mudhar 🙂
        My mic is going to line input. I’m a CS student and I have little knowledge in electronics. Frankly I have know idea about your reply. Do you also use external power source for your preamp? My preamp setting is borrowed from this.
        I tested out the on-board stereo mic and it seems to work fine for my project. I will test those mics and preamp again later but I really do appreciate your help.

  4. I suspect your problem is a shortage of power for the electret 🙂 I’ve taken a look at your amplifier and there’s nothing inherently wrong with bitluni’s design, but you are probably running your electret with not enough voltage across it. Why is this?

    Take a look at the datasheet for the Primo


    para 3-5 tells you the operating voltage wants to be between 3V and 10V (3V~10V)
    para 3-6 tells you the current draw is 600uA max

    bitluni tells you to use a 10k resistor between your electret and the +3V rail. Some voltage will be lost in this resistor; since your mic needs at least 3V this tells you that you will definitely be using this out of spec. How much?

    Let us guess the mic is drawing half of the maximum current, ie 300uA. from Ohm’s law (V=I*R)the voltage across that 10k resistor is 10,000 * 300 / 1,000,000 = 3V

    Take this off your 3V battery supply and you have nothing left! In practice what will happen is the current drawn by the electret will fall in some unknown way as you run it out of spec, what you do know is you cannot provide the capsule with the conditions it need to work properly. The data sheet is The Law 🙂

    Take a look at the Panasonic WM61A datasheet


    this tells you it will work at 1.5V, although at lower gain than specified at 2V, and has a maximum current of 0.5ma (500uA)

    So let us calculate the voltage lost in that 10k resistor at half the maximum current (250uA)

    this is 10,000*250/1,000,000 = 2.5V. Take this off your 3V battery supply and there is 0.5V across the capsule, maybe. It is also working way out of spec.

    Take a digital voltmeter (DVM) and measure the DC voltage across your capsule. You will probably find it is low and out of spec. You must fix this to make the microphone work right. Other you will get low gain or nothing, and probably noisy. As you have observed.

    The quick and easy fix is to switch your 3V battery for a 9V PP3 battery. Both the WM61A and the Primo have a maximum operating voltage of 10V so you are still within spec because 10V > 9V. But now you will have enough voltage across the electret to be within the range specified by the datasheet, so it should work right. You should have roughly 7 to 8V across the capsule terminals – if you go back to the datasheets this is good, it’s between 3 and 10V. Check with the DVM. If this is good you can test if bitluni’s circuit works OK at the higher voltage – it probably will.

    Measure with the DVM the voltage on the C terminal of the transistor. If it is more than 3V and less than 7V then it is OK. Ideally it will be about 5V. If it is lower than 3V then increase the 100k resistor across C to B – try 220k (or simply add another 100k in series).

    If it is higher than 7V then reduce the 100k a little – try 68k or 47k (or put another 100k in parallel with the old one).

    If you must use a 3V supply then you need to reduce the 10k resistor from the mic+ to the +3V. How much? Well, for the WM61 you would like 2V across the mic so you need 1V across the resistor. You know the current is estimated at about 300uA, so Ohm’s Law will tell you V=I*R, so R=V/I

    So you want a resistor of 1/300uA= 3333.33 ohms. Fortunately a preferred value is 3300 ohms. Alternatively if you only have 10k resistors three in parallel will work.

    You will get a lower gain at 3V supply and it is probably worth checking the transistor C terminal is between 1.5V and 2.5V. 3V is low for analogue audio circuits – switching your battery for a PP3 is the easiest fix.

    1. Wow this is a very thorough explanation! Thank you, again, supremely for your effort and kindness. I will try out next week or the week after and reply. Currently I have a web development project. A typical student life 🙂

  5. Hello,

    I expect using this sound card recording beehive sounds.
    As I want the best record, I try to find a device which is able to record with 192 kHz sampling rate and 24 bits.
    Does Wolson audio board allow this type of project ?



    1. Yes, it does 192k though you’ll have an easier time using something like a Behringer UCA-202 which works fine with the Pi and a stock Raspbian build once you have pointed ALSA to the right sound card. You’d have to do that for the Wolfson too.

      You need to use a fast enough card or ext HDD though – I was getting buffer underruns at 44.1k so you’re pushing your luck at 192k on a regular SD card

  6. Thank you ,

    I read UCA-202 tech spec, max sampling rate is 48kHz 🙁
    But I find this USB audio card http://www.thomann.de/fr/steinberg_ur12.htm#bewertung which seems to be great.
    But the integration of the card is not as compact as the wolfson and for my purpose, the wolfson + raps can be enclosed in a small waterproof box.
    As I already play with raspi, I am tempted by this one if Wolson SC is able to record stereo ?

  7. Thanks a lot Richard for your advices.

    I am thinking more about my specs.
    As I have two beehives side by side, I think I will try to record two hives in the same time (to compare both).
    In each hive, I will record two channels :
    – first one : electret mic
    – second one : piezzo fixed in the frame and “glue” with beewax like this one : http://tai-studio.org/index.php/category/projects/project-hive-listening/

    So, if I proceed like that, I need four channels and Behringer UMC404HD seems to be suitable (if it’s woorking with linux and/or Raspi).

  8. I have a wolfson (former model, not the cirrus one) + RPiB with the newer Raspbian image distributed by
    I can record and play through the headset connector (also using the internal mic),although I find the volume very low, by using i.e.
    arecord -Dhw:0 -r 44100 -c 2 -d 5 -f S32_LE test.wav
    aplay -Dhw:0 -r 44100 -c 2 -d 5 -f S32_LE test.wav

    Instead, I cannot manage to record using the linein. Do I need another kinf of mic?
    The card comes with no info on what mics can be connected and where (at least at a level that I can understand). What kind of jack should my mic have to work through the linein?

    Also, can I use audiomixer to tune the volume? How?

    Finally, if I try to use 1 channel:
    arecord -Dhw:0 -r 44100 -c 1 -d 5 -f S32_LE test.wav
    I get:
    Channels count non available
    Why? Can’t I record with 1 channel? For what I want (an automatic recording system
    recording i.e. 5′ every 30′ ) , saving space would be important.

    Excuses if my questions are too elementary…

    1. You need to set up the inputs via alsamixer (run as root or sudo) or cheat like I did and edit the provided shell scripts to set it up.

      As for mics, depends what sort you are using. The headset input is designed for an electret capsule which is fed with a voltage from the mic jack which is a 4 pole TRRS socket wired to the OMTP standard like PC headset on here.

      If you are using a dynamic mic (typical vocal stage mic) you just ain’t gonna go anywhere with this. The audio gain is simply far too low and the hiss level too high, you need a microphone preamplifier.

      You need the Cirrus Logic version of the card to enable plug in power on the line input, if you are using an electret mic that needs it. Since you only want mono, go with the headset input.

Leave a Reply

Your email address will not be published. Required fields are marked *