Pages: [1]   Go Down
Author Topic: Play MIDI from SD  (Read 688 times)
0 Members and 1 Guest are viewing this topic.
Munich
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 212
Posts: 8967
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Of course you can add a shield to get full MIDI instrument: http://shop.moderndevice.com/products/fluxamasynth
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Munich
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 212
Posts: 8967
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks, that looks very good, maybe i'll buy it smiley
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.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Nowhere
Offline Offline
God Member
*****
Karma: 3
Posts: 852
|-\ |\|\
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Soundcloud page: http://soundcloud.com/beefinator-2
Youtube channel: http://www.youtube.com/user/beefinator14
Old soundcloud page (ran out o

Pages: [1]   Go Up
Jump to: