Ist there any public project to build a MIDI file player from an Arduino?

Hello, I wonder if there is any project going on here or somewhere or wherever that turns an Arduino into a midi file player. I have seen a video on Youtube or so, where someone shows a solution with an sd-card and a 16x2 display, but unfortunately this is only a demonstration that it can be done, not how.

So I was wondering if someone saw a project like this is developing here somewhere in public? I would love to have a really small midi file player with the possibility to alter the midi-stream in realtime...

Thanks a lot! Martin...

clockdivider:
Hello, I wonder if there is any project going on here or somewhere or wherever that turns an Arduino into a midi file player. I have seen a video on Youtube or so, where someone shows a solution with an sd-card and a 16x2 display, but unfortunately this is only a demonstration that it can be done, not how.

So I was wondering if someone saw a project like this is developing here somewhere in public? I would love to have a really small midi file player with the possibility to alter the midi-stream in realtime...

Thanks a lot! Martin...

I doubt the arduino has enough processing power to decode realtime midi and generate the audio output as well. Besides you will need the memory to store the samples for piano, drums etc.
It would be easier to use a MIDI/mp3 decoder like the VS1053 VLSI Solution-VS1053 - Ogg Vorbis / MP3 / AAC / WMA / FLAC / MIDI Audio Decoder / Encoder Chip
The arduino can be used to send the MIDI data to the Vs1053 which will decode it and generate the audio output.

I created a mp3 player based on the arduino and vs1053 which can be seen at http://kalum.posterous.com/50759184
The same method would apply for MIDI decoding, just send the file/MIDI data and the vs1053 will decode it.....

Thanks a lot for your reply, but I did not mean to make the Arduino produce any sound at all, I just want it to send the midi events from midi files on the sd-card to a midi-out, thats all...

Actually I found a complete ATMEGA8 and ATMEGA168-based solution, which is unfortunately NOT for Arduino, but it might be possible for me to solder the stuff together. The biggest problem I have is that I have no clue how to program the bare ATMega-Chip... Yet...

Have a look at this (german) page: It seems not toooo hard to build up such a thing... I will try...

Thanks for your kind post! Martin...

Hmmmm, thank you very much. Actually I searched a lot, but I did not see that there is an old forum. Nevertheless one thread I had found by searching on Google, it is this one. Unfortunately it shows only that it can be done, but not how, it is this one:

It works!

Here someone is brainstroming...

Here again someone announces such a project, and in October 2010 in the third post "god member Grumpy_Mike" says: "Lots of MIDI projects about but I have not seen anything like this, but it shouldn't be too hard, but you will probably end up writing it yourself. " This was not so long ago...

Here someone built such a thing, as far as I understand, but it is quite much oversized and I am not sure if it really is a standalone midi file player...

In the end there is no complete project I could find, where everything is put together with display and sd-card and so on... Seems I have to, well not start from scratch, but... :cold_sweat:

clockdivider:
Thanks a lot for your reply, but I did not mean to make the Arduino produce any sound at all, I just want it to send the midi events from midi files on the sd-card to a midi-out, thats all...

Actually I found a complete ATMEGA8 and ATMEGA168-based solution, which is unfortunately NOT for Arduino, but it might be possible for me to solder the stuff together. The biggest problem I have is that I have no clue how to program the bare ATMega-Chip... Yet...

Have a look at this (german) page: It seems not toooo hard to build up such a thing... I will try...

Thanks for your kind post! Martin...

The Atmega168 was indeed used in the inicial Arduino boards, so I dont know why you say it doesnt work in a regular arduino..

Hmmmm. Wait, just to make sure I understand...

Do you want to say, that once one has the AtMega168 programmed, one can plug it onto the Arduino-Board. Maybe you have seen, that the ATMEga168-Project was completely written in pure C, so it won´t fit into the Arduino IDE...

Maybe I can understand, that the ATMega168 might run the prog while on the Arduino-Board, but still I have to adjust a lot of code to make the SD-Card run and so on, no?

Sorry for my maybe stupid questions, I am an absolute beginner in programming micro processors...

KE7GKP:
Did you find this?: http://arduino.cc/en/Tutorial/Midi Surely that is the starting point. I typically use the main Google search and use arduino as the first word. For example, I go to www.google.com and search on: arduino midi which returns over 1 million hits. There is absolutely several spot-on answers to your questions there in the first several pages of hits.

If you go to Arduino Forum and scroll down you will see "Forum 2005-2010 (read only)" where there is yet more content than here in the current version. I assure you that there are MANY spot-on discussions. Work on your search skills.

Thanks a lot, yes I have seen the tutorial... I suppose I can search together all the small components of codes and snippets and ideas and hardware and so on, but I was simply wondering if ever someone built a midi file player for Arduino. Yet I have NOT seen any. I have seen solutions, where midi-notes are hardcoded into the source, I have seen a lot of midi-out, have seen the USB-To-Midi thing and so on.

But I have NOT seen a Arduino project yet, that reads a midi-file from anywhere and simply send the midi-data to an out... And believe me, I have been searching quite a lot.

Yes, the Midi tutorial is a good starting point, and the lcd-display-shield-examples are a good starting point too and so are the examples for reading from an sd-card. But all in all these are all good starting point, so all in all they are a "start".

I am quite sure, that when digging into the field it would take me a month or so to build up a complete player based on an Arduino, but I appreciate it very much, if already someone else sweat for me... :grin:

Nevertheless, if I cannot find any solutions, I will try my own in some future...

Thanks a lot! Martin...

Well I want EXACTLY the thing that is shown here: Click It could be even somewhat simpler, I don´t need recording capabilities... This is really all I want...

All I need (and a lot of live performers do) is a device that sends standard midi-files to a midi-out, on demand, thats all. A plugged in synth makes the sound out of it. But as you stated: Things become complex when having to program the complete menu structure, the lcd-display, to examine the midi file structure, convert it to midi-notes and so on.

As you can see in the link above, a complete project is documented from absolute beginning to its success, but it is not for Arduino. I have just started programming the Arduino, so I was wondering if such a complete projects exists somewhere...

Thanks a lot! Martin...

Yes, that´s the problem I was afraid of. I thought that there maybe already someone made a midi-file-player. Putting the things together sounds easy, but I know that it everytime takes much longer than it sounds...

Okay... Then I have to decide whether to build the player I have the complete code and the printed circuit for or to "port" the code to the Arduino, or to plug the code together from all the blocks...

Thanks a lot for your advices! I´ll be back here when I´ll start the project....

You dont need to translate anything, the Atmega168P is functional equivalent to the Atmega328p found in the Duemilanove and Uno Arduinos.
Yes, you can replace the lcd.c and .h files with the lcd.write and whatever but its just a matter off adding all the .h and .c all inside the same folder as the sketch, the functions of the main.c will go to you skecth, the defines are toghether in the top with the #includes, them in the main there is a real main() function, everything outside the while(1) goes to setup() in the Arduino IDE, and what is inside the while(1) goes inside the loop() in the IDE, them compile and upload.

Well, if it is that simple, this will be my first approach then. This is the "porting-approach", okay...

It seems you know about the "Arduino-wrap" around the ATMega-family then?! May I ask you a more general question?

The guy that made the "pure" AtMega168-version coded the prog in C. But if one has no "connection" like USB or something to put the code into the ATMega, how is it done then? Do I need one of theses ultra-expensive programming machine as one can buy it here?

I mean, one has to plug the chip into something, then upload the code with something, and also one needs sort of IDE or so, no?

I am very interested in that, I built some gear for Arduino, but in the end I don´t need all the "surroundings". Ok, I was already putting one of the project onto a "Mini Pro", but nevertheless, I´d like to know what is going on when coding the ATMega directly...

Thanks for answering OT! And thanks for your post!

Sorry for asking too fast, I found that Atmel offers their own IDE. Incredible...

But nevertheless I cannot see how the chip itself is "plugged" to the programming computer...

Read my blog, it teachs you how to use AvrStudio and Arduino wihtout the Arduino bloat:

The next tutorial, about Timers is almost finished.

Oh man, I have to learn so much... www.mikrocontroller.net has a tutorial on the page... One of the hardware requirements is a "evaluation board". Among a lot of others, one of the is the Arduino. Okay, So I learned right now, that I already have a board to program an Arduino "directly"... :fearful: :blush: :astonished: :cold_sweat: :roll_eyes:

Hmmmm. Okay then... Now breaking my thoughts down to undefined guesses: The Arduino IDE calls a compiler that translates the "Arduino code" to assembler, I suppose?

Okay, you already answered, I´ll dig into your page! :smiley:

Hell this stuff makes me crazy. It so great... What a discovery... I´d only wish I had seen als this great stuff earlier...

The Arduino IDE uses avr-gcc a special part of GCC mande to compile C code for AVR's, it also uses Avr-libc for all the C librarys and that libs where writen for avr in mind so they are very efficient, this is the very same compiler used in WinAvr that can be used inside the AvrStudio IDE to program your Arduino directly without all the Arduino libs and withtout all the magic, in AvrStudio you deal with the guts of the micro, so you know exactly what it will do and how it will do it.
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.

As I said, read my blog and you will see that you dont need anything more than the Arduino board, the Atmega 8, 168, and 328p are the same, they only differ in flash, ram and eeprom sizes, but the program for one will run in the other.

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! :smiley: 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 :wink:

Senso:
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).

Thank you girls & guys! :slight_smile:

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 :smiley:

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...

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 = ARDUINO
  • 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...