welcome: please sign in
location: AudioCodecShield

Audio Codec Shield

Note: The Codec Shield does not directly work with the Arduino Mega - we reccomend the Leaflabs Maple for higher-end work. Also, we currently do not have SD card support.

About the Audio Codec Shield

The MICrODEC went on a diet, and it can now fit into its summer clothes - the Arduino! The Audio Codec Shield is an Arduino shield that uses the same Wolfson WM8731 codec which can do up to 88kHz, 24bit stereo. The Audio Codec Shield has 1/8" stereo input and headphone output jacks, a single pole analog input aliasing filter, and 2 potentiometers for varying parameters in your code.

The Audio Codec Shield pins out all of the useful pins on the codec, including the microphone pins, the line in and line out pins, the headphone pins, and the midrail bias voltage pin. This extends the Shield's productivity beyond the Arduino, to a general purpose breakout board for the codec. It also has a 5V to 3.3V level translator so it can be used with most microcontroller platforms. And the enable pin on the level translator is pinned out, in case you want to multiplex your SPI line.

The WM8731 has a lot of useful features, and routines have been written for most of them for both Arduino and Maple (the 32bit Arduino alternative). The codec is DC coupled on both the input and output, so you can even use it as a high quality ADC and DAC, all the way down to a 2kHz sampling frequency. The variable sampling rate comes in handy when using the Arduino, as there isnt much processing power available. But don't worry, the Maple gives at least a 4x performance increase from our tests.

Programming Examples

The Audio Codec Shield can be used with any microcontroller, but we have layed it out for the Arduino and Maple to get more people involved in making interesting musical applications. To help promote this, we have also made a number of example sketches and libraries to get you started quickly. The main programming structure follows that of the MICrODEC: the program initializes the codec, and then waits in the main loop until it is interrupted by the codec, at which time it executes your code in the interrupt service routine. This gives the best audio quality, as it ensures that nothing else will delay the processing of your audio data. But, this also means that all of your functions must fit within the time allotted between audio samples, and other functions that rely on interrupts can't be used (like delay()). Different programming structures can be used, but this one is the easiest and gives the best results.

Libraries: Arduino1.6 (latest version of the IDE)

Libraries: Arduino1.0 (older version of the IDE)

Libraries: Arduino-0022 (older version of the IDE)

Libraries: Maple

Installing Libraries

Due to the differences in hardware between the Maple and Arduino, the sketches for one platform might not work with the other. Above are libraries for both platforms, which need to be placed in the libraries folder inside of your Arduino or Maple sketch directory. After you unzip the AudioCodec folder and place it in the libraries folder, restart Arduino and load one of the example programs to test out your board.

Attention Maple users:If you are using Maple-IDE-0.0.11 or lower, you must to update the timer.c file. Directions for doing this are in the AudioCodec_Maple/patches folder.

If you are not certain where the libraries folder is located on your computer, try the following:


Open up the Arduino software, and go to Sketch -> Add File..., and a window will pop up that is your sketch folder. This is usually C:\Documents and Settings\<your user name>\My Documents\Arduino. If you see a libraries folder, put the AudioCodec library in there. If you don't already have one, create the libraries folder in that directory.


Open up your Arduino sketchbook folder. This is typically /Users/<your user name>/Documents/Arduino, or /Users/<your user name>/Documents/Maple if you are using Maple. If there is not a folder already named libraries, you should create one and place the unzipped AudioCodec library within it.



Files: Version 1.0

Files: Datasheets

AudioCodecShield (last edited 2015-04-08 13:36:27 by guest)