v0.1 of the module driver is done. Uses the “U” port on Gadgeteer
API Surface Area:
MidiModule
public event MidiMessageReceivedEventHandler MessageReceived
public bool SoftThru { get; set; }
public void EnableReceiver()
public void DisableReceiver()
public void SendChannelMessage(MidiChannel channel, MidiMessageId id, byte data1, byte data2)
public void SendChannelMessage(MidiChannel channel, MidiMessageId id, byte data1)
public void SendNoteOn(MidiChannel channel, byte note, byte velocity)
public void SendNoteOff(MidiChannel channel, byte note)
public void SendPolyphonicAftertouch(MidiChannel channel, byte note, byte pressure)
public void SendControlChange(MidiChannel channel, byte control, byte value)
public void SendProgramChange(MidiChannel channel, byte program)
public void SendChannelAftertouch(MidiChannel channel, byte pressure)
public void SendPitchWheelChange(MidiChannel channel, Int16 value)
public void SendChannelAllSoundOff(MidiChannel channel)
public void SendChannelResetAllControllers(MidiChannel channel)
public void SendChannelLocalControl(MidiChannel channel, bool localControlEnabled)
public void SendChannelAllNotesOff(MidiChannel channel)
public void SendChannelOmniMode(MidiChannel channel, bool omniModeEnabled)
public void SendChannelMonoModeOn(MidiChannel channel, byte numberOfChannels)
public void SendChannelPolyModeOn(MidiChannel channel)
Helper classes:
MidiUtility
public enum MusicalNote
public static byte NoteNameToMidiNoteNumber(MusicalNote note, int octave)
public static MusicalNote MidiNoteNumberToNameAndOctave(byte midiNoteNumber, out int octave)
General MIDI
public enum GeneralMidiDrumNotes
public enum GeneralMidiInstrumentPrograms
public enum GeneralMidiControlNumbers
Others
public enum MidiMessageId
public class MidiMessage
{
public MidiChannel Channel;
public MidiMessageId ID;
public byte DataByteCount;
public byte DataByte1;
public byte DataByte2;
}
There’s very little in the guts that’s Gadgeteer-specific, so with a little conditional compilation, I should have no issues making a version of this that works on other netmf devices (that’s also the reason behind the pin header on the board)
No SysEx or clock implementation yet.
Also, I plan to provide more specific events as the current generic MessageReceived event requires you to understand how the different bytes are used.
I wrote a little test program that scrolls through program changes using one button, triggers a note with another, and uses the Joystick for pitch bend.
I’m taking requests if there’s some functionality you want to see baked in or in an optional utility module
Pete