chipKIT® Development Platform

Inspired by Arduino™

Audio Visualiser

Created Sat, 11 Aug 2012 18:03:47 +0000 by majenko


Sat, 11 Aug 2012 18:03:47 +0000

Just for shits'n'giggles I have knocked up a fun stereo audio visualiser using my high speed double buffered GLCD library.


Audio inputs are to A0 and A1, and need to be shifted up by 0.5Vcc - a simple 22µF capacitor and 2x10KΩ voltage divider per channel works well.

You'll need to tweak the GLCD pin settings to connect your display up.

Jacob Christ

Sat, 15 Sep 2012 19:19:14 +0000

Cool... if you could play back a wave file on an SD card that would be really cool.



Sat, 15 Sep 2012 19:58:12 +0000

You mean like with this:


I guess I could port the firmware from the dsPIC to the pic32 - shouldn't be too hard. The main issue would be the audio output - the dsPIC has a real sigma delta DAC on-board. Yes, I could PWM it, but I don't like that.


Mon, 17 Sep 2012 11:02:52 +0000

This Audio Codec board ought to fix that problem:



Mon, 17 Sep 2012 12:26:10 +0000

If I wanted an add-on board then I'd use my own (pictured above) and not bother with the PIC32 at all.

Personally I'd use a dsPIC with more IO pins (say an '804) and drive the LCD direct from that. The DSP in it would do the FFT in the blink of an eye, and the built in ΣΔ DAC would reproduce the sound with perfect (well, perfect for a PIC) clarity.

But then it wouldn't belong in this forum ;)

Now, if only I could read/write the SD card faster. The MCP MDDFS library seems to be rather slow. I'm unable to record at aything over about 16000Hz stereo, as you can't write to the SD card fast enough. It'd be nice if there was a parallel SD IO interface for the MDDFS library to leverage the full speed of the SD card, instead of the crumby SPI one...

Jacob Christ

Mon, 17 Sep 2012 15:28:44 +0000

Have you looked at this thread?

Or this one?

When checking for if there is another byte available the SD lib appears to read out the whole block, so if you check less often you don't have re-read the whole block.

I imagine something similar is happening when you read. The whole block gets read out, modified then written back. Since the library was ported from Arduino which suffers from low RAM its not likely the memory is buffered. The SD lib needs some work to speed up for PIC32 RAM advantages.



Mon, 17 Sep 2012 16:01:12 +0000

I don't think you're following me.

The SD work that I do isn't on a PIC32 - it's on a dsPIC. It's not using the ChipKit libraries, but the Microchip MDDFS library.

I already do block reading/writing, using DMA to transfer blocks of data to the DAC or from the ADC.

This isn't something for you to worry about. I'm already pushing the SPI interface to the SD card to the limit - the only way to get it any faster is to use the 4-bit SD/MMC interface. Then I could push it right to the 30MB/s that this card can (supposedly) do.

As for playing sound on a PIC32... maybe I'll write a RetroBSD driver to do the ol' PWM audio, then I could just write to /dev/pcm or something... I'll add it to my to-do list...

Jacob Christ

Mon, 17 Sep 2012 16:27:05 +0000

I see, your right, I didn't follow.