element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Blog Can you hear the Wolf(son) calling? Setting up and using the Wolfson Audio Card
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
GPIO Pinout
Raspberry Pi Wishlist
Comparison Chart
Quiz
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: cstanton
  • Date Created: 14 Mar 2014 2:40 PM Date Created
  • Views 6245 views
  • Likes 5 likes
  • Comments 60 comments
Related
Recommended
  • wolfson
  • raspberry
  • audio
  • pi
  • microelectronics
  • micro
  • raspberry_pi
  • wm5102
  • raspeberry_pi_accessories
  • electronics
  • hd_audio
  • card
  • hd

Can you hear the Wolf(son) calling? Setting up and using the Wolfson Audio Card

cstanton
cstanton
14 Mar 2014
image

 

This audio card will push your Pi.

 

The Wolfson Audio CardWolfson Audio Card has taken a good amount of time to come forth from Wolfson Microelectronics and with decent reason. They want to make sure that they have it right and something that you can work with. As with any audio setup it takes a little time to optimise and get it setup correctly, but once you're there then you have a potentially powerful portable audio sensation in your hands. The audio codec with digital signal processor for voice, WM5102 even won an award in 2013 for innovation from the Institute of Engineers and Technology (IET)


The package for the Wolfson Audio Card comes in the standard Raspberry PiRaspberry Pi add-on box that you may be used to if you've picked up a GertduinoGertduino or Pi FacePi Face. The box clearly informs you as to the features the device comes with and where to go for more information. Chances are you're going to need it.

 

Upon opening the packaging you're presented with the regulation anti-static bag containing your card along with a slip of paper covering regulations compliance and rather curiously, a plastic screw. It seemed odd at first why there was a lone screw in the box, but once I fitted the audio card to the Raspberry Pi it became clear.

 

To ensure that the boards push/pogo-pins make contact with the Raspberry Pi, using an unpopulated header next to the GPIO breakout it needs the screws to make sure that the board is pushed securely to the Pi. I found it stranger that it wasn't a metal screw, but this makes sense after making sure that it was fully in, it potentially touches on some on-board circuitry and we wouldn't want any short-outs to happen.

 

Before getting started with the setup, make sure that you have any USB devices that you're going to use with it, plugged in. I had the unfortunate experience later when I exchanged my USB devices for others that the Raspberry Pi restarted. There is warning of using USB hubs in the user manual so I suspect this is related and possibly an issue with power.

 

The best choice to get started is to write the SD Card image provided on element14 to get started with the card, there are a number of modifications and hacks to the stock Raspbian kernel and installed modules that have been necessary to get the device to work.

If you're running Windows then you can download Win32DiskImager to write the image to the SD Card, so long as you have Administrative rights and a way to connect your SD Card to your computer. Or if you're running Linux you can use the dd command to write it to your /dev/<device name> card. If you need to check this, then typing 'man dd' at a terminal will help you with the dd command, and typing 'dmesg' at a terminal will help you to determine what your SD Card is referred to as.

 

You have the option of downloading and compiling the kernel/driver source code and apply the patches to it to get it to work and then install the modules; but unless you're comfortable with cross-compiling on a faster computer and debugging any problems that occur you're going to be waiting a long time, not just for compiling on your Pi but also downloading the source files for the Raspbian kernel. Hopefully Wolfson Microelectronics or a member of the community will bring out a Raspbian package to install from or the changes will be integrated into the Raspbian OS by default in the future.

 

*Edit*: Ragnar Jensen has pulled out the compiled kernel and modules for the Wolfson Audio Card along with the use case scripts and put them into a compressed file that you can extract on your existing Raspbian installation. Note that this will lock you down to using a specific kernel that will not be updated when you update Raspbian, you can get it from here.

 

The SD Card needs to be of Class 6 or higher, especially if you want to read/write high quality audio, of note is that the Raspbian installation, which I downloaded at least, has been modified by Wolfson and attempts to overclock the Raspberry Pi to 900mhz with slight voltage alteration. This can be disabled in the config.txt in the /boot/ folder by finding the relevant lines and removing them.

 

So, let's test it by playing music! When you have booted your Pi with your audio card attached and SD Card setup you will want to open LXTerminal on the desktop, then type one of the relevant commands, assuming that you are in the /pi/home directory, based on how you want to listen to your music:

 

CommandDescription
./Playback_to_Headset.shIf you want to use the black headphone jack
./Playback_to_Lineout.shif you want to use a set of powered speakers from the LineOut jack
./Playback_to_Speakers.shif you want to use a set of speakers powered from/connected to the header(s) on the board
./SPDIF_playback.shUse the S/PDIF digital connection on the board

 

These scripts are located in the 'pi' user account home directory (/home/pi) and they are just a set of commands for setting up AlsaMixer (aka amixer, which PEarle has gone into more detail in his tasty write-up here: Wolfson Audio Card - Command Line recording ) to use the relevant device for outputting the audio. Once you're familiar with Alsa and the scripts you can edit these as you see fit, they commit themselves such that they're persistent after a reboot of the Pi.

 

Once you have setup your output, we can run Music Player from the desktop, the playlist is already populated, then just play away. These audio files are in a very nice .flac format which is a non-loss audio compression standard. For me there was some delay before the play started, and there were gaps, clicks and pops. This is because I was using a Class 4 SD Card, I changed this for a Class 6 and played just fine. It still wasn't very fast on occasion though, with this particular Raspbian installation there is a CPU usage monitor on the taskbar which was regularly sitting at 100% usage.

 

Now, to record on the Wolfson Audio Card is a different matter, it isn't straightforward to install audio software such as Audacity and just record. The best way to check it is to run a command from the terminal again. To setup AlsaMixer using the scripts you can choose one of the following, assuming that you are in the /pi/home directory:

 

CommandDescription
./Record_from_Headset.shRecords from the boom mic' on a headset
./Record_from_lineIn.shRecords from a powered/amplified device/microphone on the line in jack
./Record_from_DMIC.shRecords from the stereo microphones that are situated on the Wolfson Audio Card
./SPDIF_record.shRecords from the digital S/PDIF connector

 

For recording, unfortunately I do not have any S/PDIF equipment, or a boom microphone style headset, so I mainly tested the on board digital stereo microphones! I can confirm that they're definitely in stereo, record quite clearly with minimal post-cleanup, but the channels were opposite to how they are marked on the board (left was right and right was left). Which is just a minor point really.

 

Fullscreen 5706.contentimage_30817.html Download
<html><head><title>Jive SBS</title></head>
<body><font face="arial,helvetica,sans-serif">
<b>Error</b><br><font size="-1">
An general error occurred while processing your request.
</font></font></body></html>

 

In the picture to the left, in the audio file I recorded via command line and then loaded into Audacity you can see where I spoke into each left/right channel individually at an intentional offset.

 

You can also see what the record quality is like for silence up until that point, initially there is some raised audio level and the click of initialisation. It is probably a good idea to bare this in mind when you're recording and to do some post cleanup depending on what you're using it for.

 

The method suggested to record audio on the Wolfson Audio Card is specified in each of the .sh files, which you can run the command "less ./Record_from_DMIC.sh" to read. I didn't manage to get Audacity to record from the card directly as it only had options for S/PDIF - I am assuming this is because of how Audacity integrates with Alsa and that this is not currently setup in an ideal way even by switching with the scripts (use cases) provided. Edit: It's worth reading Ragnar's post below in the comments regarding using Audacity with the Wolfson Audio Card, in particular the post on altering the use case for the on board digital microphones (DC offset on microphones and workaround.).

 

All in all it's a nice little board but it's going to take a bit of polish and work from Raspbian/the Community/Wolfson microelectronics to get the process streamlined, but I'm thankful we now have the opportunity to do so! The results are definitely worth it.

  • Sign in to reply

Top Comments

  • e14 Contributor
    e14 Contributor over 12 years ago +2
    I have found that if I select wolfson_pi_soundcard: AIF:0 as input in Audacity, it will record from whatever I have selected with the "Record_from..." scripts. There is DC offset when recording from the…
  • e14 Contributor
    e14 Contributor over 12 years ago +1
    Hey Chris, Nice fyi..
  • e14 Contributor
    e14 Contributor over 12 years ago +1
    Thank you Chris for this very useful walk through/review.
  • royleith
    royleith over 11 years ago in reply to e14 Contributor

    Hi, Ragnar,

     

    As you were. I did complete the working mixer. I, then, decided to update to the latest Cirrus software.

     

    Alsamixer is significantly different and several of the controls no longer report the actual values set in amixer. image  The card now appears correctly as hw:1. The Master control is gone and the only way to adjust the playback volume is using the panel widget. It was better when all of the key controls were available in amixer. Finally, the driver is broken! Muting and unmuting the 'HPOUT1 Digital Switch' (aka the headset mute switch) brings up the Mute warning in the Panel icon.image It makes no difference whether the headset is connected to the playback path from the Raspberry Pi (AIF1RX) , or not.


    I have tested this with both my mixer revised to work with the new driver and manually setting the values in amixer. I have not actually tried out the latest mixer with sounds (although I have checked that all of the settings are correctly set in amixer), but it looks as though the headset switch must always be on in order to play the Raspberry Pi back through any of the outputs. This is a significant error that was not found in the previous driver.

     

    I'm going to put things on hold in the hope that, when the Raspian kernel has the driver coded in by default, Cirrus will have got their act together re the driver.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • royleith
    royleith over 11 years ago in reply to e14 Contributor

    Well, I've bitten the bullet and got a working mixer. It does not include equalisers, compressors and HLPFs, yet, but it has all of the switches and volume controls included in your scripts plus a number of other controls like mutes and input level controls. Any input can be patched to any output. I am already regretting not putting a high pass filter in the record channel.

     

    Audacity does not seem to care what the switches are set to.

     

    I need to master tabbed or pop-up panels for the EQ and to use all four inputs on each output channel. Patching in fixed filters and compressors should be doable later with the current, single panel design.

     

    There seems to be no way of sharing lightweight programs like this either here on element14 or over on the Raspberry Pi Forums.

     

    PS, The register settings for the equalisers are get-able and settable via amixer. I have spread-sheeted all the numbers and the values given in the Wolfson evaluation card program image from a few messages ago and done the hex to dec conversions, but cannot make head nor tale of what the codes mean. Some numbers are just the product of others. They are just the same as in the wm5102 pdf table. It's a shame that Cirrus don't give a bit more guidance. Thankfully, the DSP programs are not settable via amixer and so I have put the DSP book away!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • e14 Contributor
    e14 Contributor over 11 years ago in reply to royleith

    Hi Roy!

    I haven't been able to get alsamixergui to work with the Wolfson card either. I get the segfault too. It works with my other sound cards, though.

    I think the problem is that the Wolfson card has more controls than what alsamixergui allows for. I had a quick look at the source code, and I think there's room for 256 controls. But the Wolfson card has 465 controls image.

    Nevertheless, I don't think alsamixergui would make you much happier. It's just a graphical wrapper around the standard ncurses alsamixer.

     

    If you have a very big screen, you could try qasmixer. When it displays a Wolfson card it fits nicely on my two side-by-side 24" monitors image

     

    It is possible to adjust the EQs center frequencies, band width and shelving options with amixer, but there are 42 values to poke... The only way I know of to get the correct values for the EQ registers is to use the WISCE software.

    --

    Ragnar

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • royleith
    royleith over 11 years ago in reply to royleith

    Hi Ragnar,

     

    As you were! I was failing to pass the 'eq' argument to the script. I used alsamixer to connect playback to EQ1&2 and HPOUT2 to EQ1&2 and the equalisers could then be adjusted with the relevant 'faders'.

     

    It looks like everything in the WM5102 is available including the DSPs. It was great fun giving myself earache by connecting up Tone Generator 1 & 2. I might, also, have to get my DSP programming book out! It would be fun to add a bit of echo or reverb.

     

    It would be nice to be able to poke the EQ registers, but I think that might require alternative access to the driver API. Please let me know if you ever found a way to do that via amixer.

     

    There are too many options available for alsamixer to be a regular tool and a more intuitive (and prettier) GUI is needed. Python with Tkinter looks like a good bet.

     

    Roy Leith

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • royleith
    royleith over 11 years ago in reply to e14 Contributor

    Hi Ragnar,

     

    It's good to see that Cirrus is still on-board.

     

    I've been looking at your scripts with the thought of doing a Python mixer. I still have a few questions that playing with Python should answer, but I recently realised that the scripts were using the command line ALSA mixer. I did a man amixer to get a better understanding. It occurred to me that the alsamixergui should work with the card. It is installed by default, but does not work (segmentation fault as user and nothing as root). In my attempts to get it to work, I discovered alsamixer which is also installed by default as part of alsa-utils. When run in LXTerminal (use F6 to select hw:0 or snd_rpi_wsp) it provides an absolutely horrible curses GUI, but it has all of the level controls and routing switches. I have not got them to work, yet. For instance, using the script to do playback via LineOut with EQ allows the master output volume to work, but the EQ levels do not.

     

    I will plod on with Python, but alsamixer provides lots of extra detail on the driver interface. Someone else might discover how to use it, but we really need something that cuts down on the options.

     

    Roy Leith

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
<>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube