Loading...
Pages: 1 [2]   Go Down
Author Topic: Library for playing MIDI files from the Arduino  (Read 1409 times)
0 Members and 1 Guest are viewing this topic.
Netherlands
Offline Offline
Tesla Member
***
Karma: 87
Posts: 9392
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Welcome!

Quote
(nitpick?)
some one who keeps nagging about details - I don't know for sure if nitpicking is the right term here (English is not my mother tongue)

Think there will be a point release soon smiley-wink

Quote
I have renamed it 'h'
much better smiley-wink
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

Sydney
Offline Offline
God Member
*****
Karma: 14
Posts: 717
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I do appreciate your time in reviewing. When I used to write software for a living it was amazing how much better code could be when a fresh set of eyes were applied and constructive comments passed.

Yes, there will be a pint release once I can check a few things.
Logged


Netherlands
Offline Offline
Tesla Member
***
Karma: 87
Posts: 9392
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Yes, there will be a pint release once I can check a few things.
I like that smiley-wink
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

San Francisco
Offline Offline
Newbie
*
Karma: 0
Posts: 22
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for your work on this -- I can see a lot of applications and think it will be helpful for a lot of people.

I have a related newbie question: For those of us without an SD-enabled Ethernet shield, what adjustments should be made? I have an adafruit waveshield and will be getting an SD breakout shield, but I'm not sure what modifications in SD reading pins to make. For instance, your MIDIFile_Play sample uses "#define SD_SELECT 4"; it might be helpful to explain what an "SD chip select pin" is and what other common values might be for other arduino versions or shields with SD readers.

Also, I imagine it would be possible to store very small MIDI files in the arduino's memory itself. That would open up some options for people who want to play back simple music or other actions (lights, servos, etc.) with an open, easy-to-modify standard like MIDI, but without needing to include an SD card in their setup. Would that be hard to do? What would be the best way to approach that?

Thanks again. Looking forward to learning enough to use this.
Logged

Netherlands
Offline Offline
Tesla Member
***
Karma: 87
Posts: 9392
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
What would be the best way to approach that?
Start building it.
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

Sydney
Offline Offline
God Member
*****
Karma: 14
Posts: 717
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Quote

Yes, there will be a pint release once I can check a few things.
I like that

Sometimes typos probably reflect the truth ...

Pint release is on the download site.
Logged


Sydney
Offline Offline
God Member
*****
Karma: 14
Posts: 717
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
For those of us without an SD-enabled Ethernet shield, what adjustments should be made?

Depends on your hardware.

Quote
it might be helpful to explain what an "SD chip select pin" is and what other common values might be for other arduino versions or shields with SD readers

SD cards use the SPI pins on the Arduino to transfer data. This is a bus (ie, multiple devices can be connected to the same pins to send and receive data),  so a device needs to know when it needs to communicate. This is done by a SELECT line, and each SPI devices needs a separate select line. The SD_SELECT define is the pin to use to select the SD card in the SdFat library.

What you need to change it to depends on how your hardware is configured, and will be documented as part of you hardware. Common values are Arduino Ethernet shield pin 4, Sparkfun SD shield pin 8, Adafruit SD shields and modules pin 10. The main thing is that all of these devices need to coexist and not use the same pin or we can't select the device independently of the others. This pin also can't be used for anything else in the program.

Quote
Also, I imagine it would be possible to store very small MIDI files in the arduino's memory itself

They would be very small indeed, as the files would need to be stored in RAM for them to be edited, which on my Uno is very small. This is not the same as the program storage memory, by the way, which is reported by the IDE when you compile your programs.

Quote
Would that be hard to do? What would be the best way to approach that?

Not especially. However, if you have a program that always plays the same music, then the music is hard coded in the software that you write. At that point you are not interpreting a MIDI file, but just sending out MIDI commands through the serial port - you don't need the overhead of a library like this one.

SD card readers are not that expensive. I got one recently from eBay for less than $1.50 (http://www.ebay.com.au/itm/280780639068?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649) that could be used as-is in a breadboard setup. I chose to mount it permanently onto a prototyping shield and put in a jumper so that I could change the select line anywhere between pins 2 and 10 so that I am less likely to clash with other cards. All up probably cost $5.
« Last Edit: January 06, 2013, 05:47:11 pm by marco_c » Logged


Sydney
Offline Offline
God Member
*****
Karma: 14
Posts: 717
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

New version 1.2 of the library has been loaded to my repository (see signature).

v1.2 has examples cleaned up and better commented. The dependency on the MIDI library has been removed . There are no dignificant changes to the core library.
Logged


Pages: 1 [2]   Go Up
Print
 
Jump to: