The PIC microcontrollers are powerful little devices, and [Tahmid] is certainly pushing the envelope of what these integrated circuits can do. He has built (for educational purposes, he notes) an audio player based on a PIC32 and a microSD card. Oh, and this microcontroller-based audio player can play in stereo, too.
The core of the project is a PIC32MX250F128B microcontroller. 16-bit 44.1kHz WAV files are stored on the microSD card and playback is an impressive 12-bit stereo audio. It can also play back 8-bit files (with some difficulty). [Tahmid] programmed the interface to work through the serial port and it is very minimalistic, mostly because this was a project for him to explore audio on a microcontroller and wasn’t to build an actual stand-alone audio player that he would use from day to day.
Still, even though the project isn’t ready to replace your iPod, the core audio-processing parts are already done if you want to try to build on [Tahmid]’s extensive work. You could even build a standalone audio player like this but have it play high-quality 12-bit stereo audio!
Hey man, awesome job.This thing is really neat, and you have the documentation to boot. You did what youset out do, for sure! Congrats.
Do you think the uC has enough power to decode encoded files? (I wouldn’t know the first thing about MP3 decoding on a uC) Is the SD card data rate the bottleneck for 16/24 bit playback (wav files are massive!)? You have any idea how much power consumption you have going on there?
Impressive!
I dont think mp3 decoding on a PIC32 would be possible in real-time because it involves some pretty heavy math and lot of memory. Even if you use fixed-point calculations, it would still need lot of multiplications for doing the IDCT (which is a variant of FFT). Memory is the other bottleneck. Just the header and huffman tables on an mp3 would be 10’s of kB. Its better done on a DSP than a general purpose processor.
Yes, though model with more RAM should be probably better.
MP3 decoder for PIC32
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2680&dDocName=en554171
FLAC decoder for PIC32
http://www.k9spud.com/traxmod
This http://www.microchip.com/wwwproducts/Devices.aspx?product=PIC32MX270F256B PIC should be better – it is still in DIP package, yet containing 64kB of RAM.
As a sanity-check, processor-power-wise… I tried to turn my 486 into a dedicated MP3-player, back in the day… it could handle low bitrates, but 128k was *just barely* too much for it. We’re talking 32bit, DOS, 66MHz. Besides the FPU, spec-wise a (MIPS-based) PIC32 might not be too far off, especially being RISC vs. CISC… a highly-optimized and *dedicated* system, maybe a newer/more-optimized encoding-scheme… especially if there exists one that doesn’t require floating-point… (I dunno my encodings, maybe OGG?). It’s *plausible*. Dunno about the RAM necessities, though. Spose this isn’t *that* much new-information over Vikas’s comment, just a different way of looking at it.
The classic iPods use 80MHz ARM and will handle up to 320kbps MP3 with ease.
There’s a fixed-point (i.e. integer-only) version of the Ogg Vorbis decoder called Tremor.
If you would like to improve upon the 12 Bit/sample thing without buying a new DAC, you can! Simply interpolate the signal properly to a higher sampling rate and do a proper word length reduction via dither + noise shaping. The noise shaping algorithm is magical in that it can push most of the noise into frequency regions we don’t care about: ultrasonics.
I already implemented interpolation + noise shaping for a similar project: https://code.google.com/p/audio-pwm/
With this code you can make your audio thingy have a dynamic range in the audible band that is equivalent to 16 Bits/sample at 44 kHz! :-)
I will never understand what people like about stereo. I made an adapter for my headphones that shorts the two channels together through 8 ohm resistors.
Wow, Dark Side Of The Moon must be extraordinarily-dull on your headset… that was meant for Quad!
And you haven’t heard captured binaural, either. Granted you may not like the typical tri-phonic crap that still dominates what comes out of studios. Look up the newer Dolby mode meant to solve this problem, and make headphone sound less multi-mono.
Is the point of this post to play good audio with low overhead? Wave files may be “massive” so is the capacity of a flash chip now. It would be nice to use flac but again that overhead cost. Is the cost of rendering wave’s high as well, or is this just a case of Mp3 bias?
@murdock
You’re so cool. Can I touch you?
It’s nice project, but 44.1 kHz stereo is hardly “pushing the envelope” of the PIC32.
hi
this project is a converted version for PIC32, the original version is at this link :
http://www.uchobby.com/index.php/2008/07/21/dspic-wav-player/