Go Down

Topic: Play MIDI from SD (Read 707 times) previous topic - next topic

Science

Hello.
I have been searching the internet for 2 Days, and i didn't find anything.
So what i want to do, i own the Arduino MEGA and UNO and the ethernet shield.
Now, is it possible to play midi files, that are stored on the SD over a speaker? Without any additional Hardware?

johnwasser

Sure, as long as you don't mind square waves and limited polyphony. :)

Of course you can add a shield to get full MIDI instrument: http://shop.moderndevice.com/products/fluxamasynth
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Science

Thanks, that looks very good, maybe i'll buy it :)
So, you said i can do it without the shield, but limited.. How?

johnwasser


Thanks, that looks very good, maybe i'll buy it :)
So, you said i can do it without the shield, but limited.. How?


There is a third-party Tone library that can play two simultaneous square-wave notes on different pins:
http://code.google.com/p/rogue-code/wiki/ToneLibraryDocumentation

You could generate square waves in software to get multi-part harmony.  We did that back in the Intel 8080 days (1975 or so) to do four-part harmony.  I expect the ATmega would be at least as capable.  Every clock tick you add a constant to an integer and if there is an overflow you invert an output pin.  A constant of 0 gives you silence.  A high value gives you a high pitch (1000 give you about clock/65.536) and a low value give you a low pitch (65 give you about clock / 1000). Minimum pitch is 1 (clock * 1 / 65536) and maximum is 65535 (clock * 65535/65536).  You could use unsigned longs to get even more resolution.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

sciguy

The Arduino can get 8 or more note polyphony, with different waveforms and volume control for each note.  So not too limited, it's more than an NES or gameboy!   :)

Check out my project, and joemarshall's

My synth can already take MIDI input, it shouldn't be hard to adapt it to work from MIDI files.
Soundcloud page: http://soundcloud.com/beefinator-2
Youtube channel: http://www.youtube.com/user/beefinator14
Old soundcloud page (ran out o

Go Up