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?
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
Thanks, that looks very good, maybe i'll buy it :) So, you said i can do it without the shield, but limited.. How?
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:
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.
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! :)
My synth can already take MIDI input, it shouldn't be hard to adapt it to work from MIDI files.