0

Is there a way to have mp3 files on an SD card in the SD card shield for the Arduino and play an mp3 file on that SD card with a buzzer?

If possible also with something like:

playmp3(thismp3.mp3);

So that if I execute that command, the Arduino will play thismp3.mp3 through a buzzer.

Thank you.

  • 1
    That will sound horrible, but with today's music probably makes no difference. Have a look at maker.pro/projects/arduino/arduino-audio-player – user31481 Feb 12 '18 at 9:24
  • 1
    it's going to be much simpler to play .wav files from the sd card – ratchet freak Feb 12 '18 at 9:28
  • You can easily play .wav files because they are basically the sound levels recorded with a certain frequency. Here's a guide how to make an .wav music player: tutorial – Coder_fox Feb 12 '18 at 19:00
1

If you're not specifically trying to make the arduino itself do the decoding and playback, you can get something like the Mini DFPlayer which would let you do essentially what you're asking for and offloads the decoding and playback so your arduino can do something else while the audio is playing.

0

It's not as easy as that. The SD card and playing audio are two different things.

However, probably the easiest way is to buy an MP3 shield (but that spoils the fun to make it yourself).

On the other hand, to make it yourself, takes quite some effort.

Also, the audio quality will be very low. Besides that, decoding MP3 is far from trivial.

In case you want to make it yourself:

  • First write a program to read (stream) bytes from the SD card
  • Write an MP3 decoder (maybe/probably there are open source variants)
  • Forward the MP3 bytes to the decoder
  • Forward the audio bytes to the buzzer

Of course, there are time constraints otherwise you hear gaps in the music.

  • 2
    MP3 decoder on an Uno...? I think not. Maybe on a Due (I ported one to the PIC32 for chipKIT a while back, and it kinda worked), but not an Uno. Not enough memory. I used to run MAD on a 25MHz Sun SPARC system, but that had megabytes of RAM, not a couple of kilobytes. For an Uno external hardware is a requirement, not an option. – Majenko Feb 12 '18 at 10:35
  • Note that it is possible to add memory to an Uno ... I did a test with a 23LC1024 and it worked. Slower than internal memory, but it worked. But I agree, the speed might be a problem too (that's why I made the time constraint remark). I don't know exactly what the requirements are for MP3 decoding, looks like more than the Uno can process. – Michel Keijzers Feb 12 '18 at 10:40
  • 3
    You're not adding memory to the Uno there - you're adding an external peripheral that happens to have memory. Adding memory to the Uno would entail including it in the memory map so you can use it for variables, etc - something the AVR doesn't support. Yes, you could offload some data into there for storage, but you can't process it while it's in there. It wouldn't just be slow - it'd be unusable for audio processing. Yes, the technology is SRAM, but in actuality it's more like an SD card or hard drive. – Majenko Feb 12 '18 at 10:42
  • True ... that's also the reason I didn't use it in my project. Because i had to make my own 'memory map' from variables to external SRAM. For MP3, I thought it could be used to store a small chunk of decoded data and to process it to undecoded data. But yes, it will not be advantage for the limited CPU speed of a Uno anyway. – Michel Keijzers Feb 12 '18 at 10:46
  • 1
    @Majenko. It look like the good old days with extended memory and expanded memory and all sort of trick around the 640KB barrier. – user31481 Feb 12 '18 at 10:47
-1

I believe MP3 uses licensed software that is implemented on decoder chips like VS1053. Usually one would use a board like this, with an SD card for holding the massive amount of info that makes a sound. http://www.oddwires.com/mp3-decoder-module-vs1053-for-arduino/?gclid=EAIaIQobChMInKS7lJGm2QIVE4_ICh1kTQa4EAQYAiABEgIKH_D_BwE You then send commands to the unit to tell it to start, stop, advance, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.