Friday, October 26, 2012

BasicSDAudio ChipKit Library

I have been working on a few Arduino and Chipkit projects that could use some decent audio generation. Many people have used Adafruit's Wave Shield in the past, but I dislike the idea of having to bit-bang the second SPI port, it requires additional hardware, and there was no simple way to port the library over to ChipKit.

SimpleSDAudio minimal setup

Enter Lutz Lisseck's SimpleSDAudio library for Arduino. It uses a stripped down SD card library and hardware PWM to output 8 or 16 bit audio in mono or stereo. I tried it out on my Arduino Pro Mini and was pleased with the results. Since it is interrupt driven, you are free to do other things in your sketch during audio playback, so long as you call the "worker" routine--which updates the audio buffer--often enough.

The library code is pretty straightforward so it was easy to go in an change ATMEGA specific code for the Arduino to PIC32 specific code for the ChipKit. I have an preliminary version working, so check it out:

The audio in the video is 8 bit stereo, sampled at 78.125kHz. Without using any more pins, the ChipKit will be capable of 10bit output at this sample rate, and 11bit output at 39.062kHz. The Arduino is only capable of 8 bit stereo when using only two PWM pins.

For more information about the SimpleSDAudio library for Arduino, visit:



  1. Check out my prototype amplifier and filter board for use with SimpleSDAudio, BasicSDAudio, and Tone libraries!
    BabyBOOMER Audio Amplifier and Filter

  2. it´s good proyect i have the same chipkit with a pic32 on the boar i think it´s the same that you are showing on the video can you tell me what are the modification that i need to in order to this run on the chipKIT thank i hope you help me please mi mail its tanks.

  3. I am still working on cleaning up the code. I have been pretty busy lately. I will be posting the code on github once it is in at least an alpha release state. There is too much to describe, it is better if you wait until I post it.

    Thanks for the interest.