Go Down

Topic: Ist there any public project to build a MIDI file player from an Arduino? (Read 10269 times) previous topic - next topic


Hello Senso! Thanks a lot! I will try to put the midi project into my UNO then!

It´s a real pleasure to meet you here!  :D Thanks a lot!

BTW.: My first love lives in Portugal, in Lisboa! I love your country!  8)


Thank you too clockdivider, just keep posting here and I will try to help you if you need ;)


The Arduino IDE in specific uses the avr-g++, that is the special compiler for the C++ code, this compiler is not as efficient as the C compiler, and in micro-controller using C++ is half a mistake because it produces bloated code, and because micro-controllers have very very little RAM memory and C++ loves to hog RAM to do simple things that C does  in a much smarter way.

This was certainly true in the ancient days when C++ compilers were new, but now c++ compilers are very efficient and C++ code is as fast as C written code. Writing in C++ using classes actually simplifies coding and readability a lot and should not be frowned upon but strongly recommended.
Regardless of the language it is proper chosing of the datatypes which would save speed and space.fr ex:  Do not use "int" (16 bits) with 8 bit microcontrollers if using 8bit "char" or "unsigned char" is possible for that data.

To summarize, it is not correct to say that g++ (c++ compiler frontend) produces bloated or slower code than gcc (C compiler frontend).


May 15, 2011, 03:34 pm Last Edit: May 15, 2011, 03:42 pm by clockdivider Reason: 1
Thank you girls & guys!  :)

I contacted Simon, the inventor of the great MIDI-file-player, and he was so kind to answer me. He also states that porting his code onto the Arduino should be of manageable effort.

Thus I will give it a try then, be sure I´ll put a lot of helplessness in here :-D

I invited Simon to the forum here, hoping he will join the thread and watch out for a beginner like me struggling with bits and bytes...

So first thing to do is to get all the parts I need. I will try to put together the list of stuff and would be very happy, if someone could have a look at the gear. I am an absolute beginner in electronics, actually I bought a book "make: electronic" two weeks ago. All in all I only wanted to build up a controller for my photographic flashes, and I succeeded with that. Now more and more I became aware, what an Arduino is and what great powerful stuff one can do with it. I am a Windows programmer, coming from C++ and MFC. It is so great to have a connection to the "real" world with all the PINs on the Arduino!

Ok, talking too much here maybe? Thanks a lot for your kindness here in the forum, I appreciate that very much! Martin...


May 23, 2011, 10:22 am Last Edit: May 23, 2011, 10:26 am by clockdivider Reason: 1
    Hello Arduinos!

    I want to start the project now, and I am looking for the right components...

    I would like to try to build up the player with very common components, if there are "common components" for a project like Arduino. I mean: I was once looking for a complete documentation of a Arduino-based midi-player, as well documented as the one on
Mr. Simons page. And that is the reason why I am starting the project now, so I want it to be the way I would like to find it if I was looking for it, all parts named, available, completely documented.

So I want to choose parts that are widely available and as much compatible as possible: So that one can take the list and order the stuff directly from the Internet and so that one can be sure the parts will work together with the board, the libraries and the software at all...

Soooooo... The list for Simons player is:

  • ATmega8 with internal RC-Rate 1 MHz
  • MIDI Interface with opto coupler 6N138
= What is this?
  • LCD Display 24*2 (standard controller)
= Which one is compatible and well available?
  • 7 buttons and 1 switch
= "Is there a ready-made "array" of buttons I should use?"
  • voltage regulation 5V and 3,3V
= okay
  • MMC/SD-Slot
= Which one is compatible and well available?

Maybe someone would like to give me some advices? Especially the "midi interface"? What is it? Should I buy a midi shield for that? If so: Please keep in mind that maybe the thing should be built around an Arduino Mini Pro?

Thanks a lot guys! As soon as I now the hardware I will start the project, hoping all you gurus will have a helping look at it? Thnaks a lot! Martin...



Thanks for mentioning my shield. I have released the next version the phi-2 shield with text-based user interface library phi_prompt.

This should get an Arduino project develop a long way into their projects and not having to worry about making up menus or collecting button inputs.
With the software library, LCD size doesn't matter as it used to be. There are automatic functions that scroll a line if it's too long or long message display in a text area where user can scroll up and down to see the complete message.

A 20X4 display will be taking full advantage of the library but a 16X2 display is all you need to set up a user interface that compares with some industry panels (I hope  ;))

Here's the links:

Software library (a new release is under way. Will post later today)

Hardware (shield)
Serial LCD keypad panel,phi_prompt user interface library,SDI-12 USB Adapter


Has anything happened recently in this thread? I am looking for almost exactly the same thing. Only my MIDI player will actuate relays that "play" strings of Christmas lights corresponding to MIDI note values (only 8 of them).
Using the sparkfun MIDI breakout shield, the K74 relay kit, and the MIDI Glockenspiel code from Mike Cook http://www.thebox.myzen.co.uk/Hardware/Glockenspiel.html I can now "play" lights using a MIDI keyboard. http://www.youtube.com/watch?v=YrDDy8ZANdA
My last goal is to read in a MIDI file and have the Arduino repeat the sequence over and over.
Is this worth a new thread?


True, but the timings are important; I hope to sequence the lights in time to recorded music (a wav or mp3 file playing simultaneously).


The standard and easiest (and probably the cheapest) way to get code onto any Arduino
board is by connecting it to a computer through a USB port.

You should previously have installed the free development IDE program on your computer.

I can't imagine that buying any special machine to program an Arduino  would be any
cheaper than buying a basic computer with a USB port.

Go Up