# Playing a small MP3 file

simulate this circuit – Schematic created using CircuitLab

I'm creating a hand-held device with a momentary push button that will activate an LED and play a sound or MP3 (I didn't include the sound card/speaker in the schematic because I couldn't find a symbol that would correspond) when the switch is down to complete the circuit. Is there a component that would let me play this MP3 when the push button is down and repeat the sound as long as the push button is down?

• So you can't afford a real sonic screwdriver? There are boards that would probably be too big available to play MP3s but no chips AFAIK. You might be better looking for sound recorder / playback chips. – PeterJ Mar 2 '13 at 1:40
• @PeterJ No. I don't want to buy a sonic screwdriver. I just feel as though it would be more fun if it was hand made. I will look into playback chips. Thanks! – Coder404 Mar 2 '13 at 2:43
• By real one I meant one that opens doors ;-). Take a look at sparkfun.com/products/10653. It might still be a bit big although the chip itself is only about 18x11mm. Commercial designs normally use a COB (chip on board) but they have to be programmed at the factory so no good for a one-off. – PeterJ Mar 2 '13 at 2:53
• Best bet is to buy the cheapest MP3 player from eBay China and wire the "play" button to your circuit. There are some small, cheap, sound recording-and-playback IC's out there of varying quality but they'll probably cost more than the aforementioned MP3 player. BTW, compressed (MP3) audio will put a lot of processing overhead on a small micro - uncompress it (WAV/IFF/raw bytes) and just give the micro the basic job of squirting bytes out. – John U Apr 2 '13 at 10:46

I noted that the mp3 file size is 52kB and I heard very little reduction in quality when I down-converted it to a 8 bit, 16k samples per sec mono wav file - it became 48kB long and this is much easier to playback.

How much memory can you afford to have on-board? Surely this is easier to handle than an MP3 file. Wondering why the wav file is smaller than the MP3? MP3 (as far as I am aware) encode the biggest amplitude frequency in a set of dozens of compartments across the audio range. As your signal is largely in the 2kHz to 4kHz area there is a lot of overhead mp3 transmission that is pointless and a useless overhead. Wav is smaller because I've tailored it to the actual audio.

I also note that your audio file is largely symettrical about its half-way time point. I reversed the whole file in wavelab and it sounded pretty-much exactly the same

This will further allow you to halve the audio size - you are now at 24kB.

You might also consider that when the button is held down long enough an appropriate middle section is repeated.

• The file is just a repeating audio pattern. It could be cut down a lot with a music editor to make it even smaller. It's not ""music"" music. – Passerby Apr 1 '13 at 22:11
• @Passerby - exactly – Andy aka Apr 1 '13 at 22:22
• Ha. I put that in before I saw the edit. Anyway, listening to it again, the sound has three distinct parts. Fade in, looped, and fade out. It be so minimal. – Passerby Apr 1 '13 at 23:07

If you don't really care about sound quality, you can do this with a simple microcontroller and one port, no decoder needed: http://telly.com/KSY5Y (similar projects: here and here)

What I did is analysing an MP3 file with Audacity to see what frequency was the most significant on what moment. After that, I created ASM routines to let a GPIO pin of the microcontroller toggle on that frequency. The reason I used such a large chip (PIC18F4620) was that I needed some program memory to store my really messy code for the long song. In your case, a simple loop will be enough, so you can do this with a very small chip instead. I used a simple piezo buzzer, but you can also use an amplifier and a speaker.

This method is fun for once and for a small sound and eliminates a lot external components. It takes some time to analyse the MP3 and write the code though, so it's up to you whether you want to do that.

• In case you want the code for this, please give a shout and I'll look it up and edit it in. Warning: it's messy. – Keelan Apr 1 '13 at 8:12
• This would be @coder404 's best option. The Screwdriver tends to be thin, like a thick sharpie highlighter, so space is limited. And the Screwdriver sound is The original sound was probably created by modulating a self oscillating filter with an LFO operating in the audio range. It's just a matter of finding the right frequency and depth, then adding a little tremlo.. IT's just a modulated frequency on loop. Wouldn't even need too much code space. – Passerby Apr 1 '13 at 20:34

Here's my DigiKey query:

http://www.digikey.com/product-search/en/integrated-circuits-ics/interface-voice-record-and-playback/2556441?k=playback

Browsing through it seems this series will do the trick:

http://www.nuvoton.com/hq/enu/ProductAndSales/ProductLines/AudioApplicationIC/ISDVoiceIC/ISDChipCorder/Documents/ISD1600B.pdf

DigiKey has a few in stock (though seems only the SOIC parts). Also note those are related to the part used in board @PeterJ pointed to in his comment above.

There are a lot of options depending on exactly what you need.

There are various other ways to get the same end result. Depending on what you end up choosing you may need to implement the repeat function (e.g. with 555).

Double check that one of the play modes for the button triggered version will handle the play and button usage that you require. There are several sub-models of the general WTV020 PCB that have various features like button inputs, SPI interface to an external MCU, etc. so pick the one that does what you need.

Also look at the VS1003 in addition to a MCU like the MSP430 or some ARM CORTEX-M0/M3 MCU and if needed a SD card to hold the audio file (if it is bigger than the 256kBy/512kBY flash memory you can get on a common MCU): https://www.sparkfun.com/products/9398