Create MP3 player

Hi there,

I'm pretty new to Arduino and I really enjoy experimenting with it. At this point I got the basics; make some simple circuits, make some stuff blink, switch relays, control some stuff via a browser (using a ethernet shield).

The next thing that I'd like to create is a MP3 player that streams music to my amplifier (3.5mm jack), this seems more complicated than I had imagined. First of all; which Audio-shield would you guys recommend - there are so many different shields available?

I'd like to do the following:
List all available in a certain directory (preferably on a thumbdrive) in the browser, then play a selected file. So far I've only seen codes that just put all available files in one playlist and let you skip through that, I want to play specific files. I couldn't find any good tutorials on the internet.

Any thoughts on whether this is possible or any good tutorials? (Can I use my Arduino Uno for this, especially when I want the same board to switch 1 or 2 relays?)

Thanks in advance,

Kinds regards,

Niellles

You will need an MP3 Shield of some kind to do the decode. Google can help there.

Since you talk about a browser you will also need some kind of network access. That can be an Ethernet Shield if you have an Ethernet outlet handy. The Ethernet Shield also has an SD (or Micro-SD) car slot for file storage.

If you need to use a USB Thumb Drive instead of an SD card you will need something like a USB Host Shield.

Once you add all this additional hardware you might be better off getting something like the DUE or even the RaspberryPie.

Checkout the inexpensive MP3 modules here
http://www.mdfly.com/index.php?main_page=advanced_search_result&search_in_description=1&keyword=mp3
Arduino can control these.

johnwasser:
You will need an MP3 Shield of some kind to do the decode. Google can help there.

Since you talk about a browser you will also need some kind of network access. That can be an Ethernet Shield if you have an Ethernet outlet handy. The Ethernet Shield also has an SD (or Micro-SD) car slot for file storage.

If you need to use a USB Thumb Drive instead of an SD card you will need something like a USB Host Shield.

Once you add all this additional hardware you might be better off getting something like the DUE or even the RaspberryPie.

I found several MP3 shields, this one for example has an USB-port. The point is that I can't find any tutorials/example code on how to create a proper media player that allows me to play a certain file instead of skipping through all files (any suggestion as to where I can find this information?)

I got an ethernet shield, so that shouldn't be the problem... Once I know how to play a specific file it won't be too much work to do that by user input through the browser...

Let's say I got a 3 mp3 files on a thumbdrive connected to the music shield: CrossRoads.mp3, johnwasser.mp3 and niellles.mp3. I'd like to write a code that can do something like this:

play(c) (where c is the filename)

Instead of all the examples that I found so far where the files would be named : 001CrossRoads.mp3, 002johnwasser.mp3 and 003niellles.mp3. Arduino would start playing at 001CrossRoads.mp3 and I can only skip through the files.

As I said; I'm pretty new to this stuff so I hope that you guys understand what I'm trying to say...

I thought about the RaspberryPie but that doesn't seem the best solution. Do you mean the Arduino Due with "Due"? What would be the advantages of this board?

Yours,

Niels

The MDFLY module that was linked does that. And if you are using an MP3 shield, you have complete control. You have to load the file off the SD card and stream it to the MP3 decoder, so you can open whatever file you want. If you want something very simple and flexible (and also plays off USB drives) check out the VMUSIC2 module.

Retroplayer:
(...) And if you are using an MP3 shield, you have complete control. You have to load the file off the SD card and stream it to the MP3 decoder, so you can open whatever file you want. (...)

Ok, awesome! The thing is; I thought working with the Adruino Uno and the ethernet shield were pretty easy, for several reasons: I got experience with php, javascript and HTML so I pretty much understand the logic of the codes and I understood the html and also there were a lot of tutorials and example codes available.

Now I want to work with a mp3 shield but I can't find a lot of information on this when working from scratch. Where should I start, what should I read?

Well, first off, what do you want to use?

There are MP3 modules like the one linked which take serial commands and an SD card. There is the VMUSIC2, which can do SPI or serial and uses a USB flash stick, or there is the MP3 shield which is really just an SD card and a MP3 decoder IC stuck on a board. The last one is the hardest, but the most flexible. The other two are simple.

The disadvantage to the module linked is that when you say play MP3 001, it just plays the first MP3 it finds on the SD card. It isn't actually using file names, but where they are placed on the card. There is also no feedback like reading the number of folders and number of files. You also cannot read anything but MP3s with it. Very simple to use, though.

The VMUSIC2 module will let you call a file by its filename, read the directory, open and write to files besides just MP3s, etc... It is a bit pricey but has alot of flexibility. The only real disadvantage is that it only takes USB drives.

An MP3 shield is really raw, so you have the absolute most flexibility with it, but your code will be more complex and take up more processing time.

If you are fine with using USB drives only, I would recommend the VMUSIC2. It is actually about the same price as the MP3 shields (unless you buy on eBay from China.) There are libraries for all of these options.

For the linked MDFLY module, I just wrote a library for it and you will find it right in this forum. I have also used the VMUSIC2 and there is library for it. I have not used an MP3 shield before.

Actually, the Arduino Due, running at 84Mhz should be able to do software decoding, with no hardware decoder needed.

This blog discusses the format, and decoding algorithm(s) which would need to be coded in the Arduino language ("C".)

They even suggest some code to work from, and in the "C" syntax.

Sorry, here is the link to the software decoding: blog.bjrn.se: Let’s build an MP3-decoder!

And, a better link: KeyJ's Blog : Blog Archive » Honey, I shrunk the MP3 decoder

Now, someone needs to put together a library for mp3 decoding/playing/conversion. We should start seeing some arduino due mp3 players in the near future.