Go Down

Topic: Library for playing MIDI files from the Arduino (Read 6 times) previous topic - next topic

marco_c

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.
Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

marco_c

#21
Jan 06, 2013, 11:36 pm Last Edit: Jan 06, 2013, 11:47 pm by marco_c Reason: 1
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.
Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

marco_c

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.
Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

scriptstyle

I am running arduino 1.0.5, I have the appropriate libraries Midi, Data flash, midifile, Sdfat... I plan on running MIDIFile_Play_LCD on a uno SDsheild and 2x16 LCD. So far just setting up libraries and waiting on a mouser order. I am a bit new to micros but not to electronics, and this is my 2nd arduino project...

Problem is when i compile the sketch i get this error
'A0' was not declared in this scope











In file included from MIDIFile_Play_LCD.ino:14:
KeyPress.h: In function 'char getLCDKey()':
KeyPress.h:32: error: 'A0' was not declared in this scope
KeyPress.h:32: error: 'analogRead' was not declared in this scope
KeyPress.h:35: error: 'millis' was not declared in this scope
MIDIFile_Play_LCD.ino: At global scope:
MIDIFile_Play_LCD:47: error: variable or field 'midiCallback' declared void
MIDIFile_Play_LCD:47: error: 'midi_event' was not declared in this scope
MIDIFile_Play_LCD:47: error: 'pev' was not declared in this scope
MIDIFile_Play_LCD:48: error: variable or field 'sysexCallback' declared void
MIDIFile_Play_LCD:48: error: 'sysex_event' was not declared in this scope
MIDIFile_Play_LCD:48: error: 'pev' was not declared in this scope
MIDIFile_Play_LCD:69: error: 'SdFat' does not name a type
MIDIFile_Play_LCD:70: error: 'MIDIFile' does not name a type
MIDIFile_Play_LCD:79: error: variable or field 'midiCallback' declared void
MIDIFile_Play_LCD:79: error: 'midi_event' was not declared in this scope
MIDIFile_Play_LCD:79: error: 'pev' was not declared in this scope

i am guessing it has something to do with my libraries? Any help would be appreciated  :)

marco_c

#24
Jan 21, 2014, 09:47 am Last Edit: Jan 21, 2014, 09:51 am by marco_c Reason: 1
A 'oh' or A 'zero'? Are you compiling a standard example?

I have just tried it on my system and it works ok with 1.0.5.
Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Go Up