Go Down

Topic: I Made a 6-voice Midi Player for Arduino (Read 669 times) previous topic - next topic


I wanted something that would play music through a speaker connected to an Arduino without having to build an amplifier.  I've tried and tried, and I cannot get a good sounding amplifier to work.  So I created a simple program that plays voices by keeping track of when to click a pin for each voice.  It plays standard midi (when run through a processing program) fairly well.

I would love suggestions on how to improve the performance of the program.  The sample program plays a 6-voice song, Maple Leaf Rag.

Here is where the code is located:

I do not use timers or interrupts.  There is a similar program that clicks pins like mine but it uses one timer per voice, so that limits what can play on an Arduino Nano with only 3 timers or an ATTiny with only 2 timers.

Also, I'm not a C++ programmer, so I haven't made it into nice functions suitable for a library.  Right now you just include the files in your sketch.

Any comments would be welcome and appreciated.
Shawn Gordhamer

Go Up