Netduino Plus 2 --- 6 Note Polyphonic MIDI Player

All of the code is located in:

This program parses a STANDARD midi file (*.mid) and then PLAYS it using the 6 built in PWM channels.   The files are stored on the SD-card.   You can play a single file,  or set it to play any *.mid files in the root directory in a row,  with an option to REPEAT.

NOTE:  The midi file should be type 0, so that all the tracks are in a single track,  NOT Multi-tracked.  Use a Midi type converter, such as:

I have successfully played up to a 38KB file.  Not sure if anything larger would work.  There is 100KB+ of RAM,  and the code is around 11KB....

This code should easily be adapted to any of the other Netduinos, as well.   I don't have any other versions to test, though.      The song data can also be embedded within the code.    Easiest way is to use a HEX convertor, such as HxD Hex Editor.  You may export the bytes as a *.cs file and embed the BYTES into the program:


Youtube Video:

That one has an add-on board that I built to MIX the 6 PWM channels as AUDIO,  then output to headphones or line-level.   A speaker can be connected, but would be better to be driven by an amplifier.


Here is an image of the Op Amp shield completed: 

(it ended up being a little sloppier than my original, due to necessary changes )


Here is the TINA-TI simulator file:

and an image of the SCHEMATIC:


If you haven't heard of it,  this is a great program offered FREE by Texas Instruments (TI):    to build and simulate electronic circuits.

OLD Youtube video
(using only a few resistor's tied off each of the PWM channels):

Last edited Feb 5, 2013 at 6:50 PM by ronzon, version 18