mInstruments
MIDI-like instruments
Description
mInstruments are designed to be easy to use MIDI-like instruments, similar to Ableton’s built-in instrument plugins. They are all derived from the mInstrument class and share some common functionality, such as responding to note on and off commands, having a single next function for generating audio, taking care of voice assignment for polyphony and outputting a nominally 16-bit signal level.
Each mInstrument consists of a single voice class (for example mStringVoice) and an instrument level polyphonic class (for example mStringInstrument). The voice class defines what the instrument sounds like and how you control it, while the instrument class handles interfacing it with the mInstrument parent class, handling polyphony and standardized input/output functions. As a user, you should use the instrument level class even if you just need a monophonic voice, however if you want to build your own mInstrument it might make sense to split it into two classes.
mInstruments are ultimately less powerful than building voices from scratch using basic building blocks, but their convenience makes them useful for cases where simple voices are needed or for quickly exploring sounds or synthesis methods. Please use them with a reverance and understanding that they are an intentional simplification and limitation of the computer music process.
Class Methods
void noteOn(uint16_t note, uint16_t vel)Triggers a note to start with a MIDI note number and velocity (0-127)
void noteOff(uint16_t note)Triggers a note to turn off with MIDI note number (0-127)
void midiStart()Starts playing a MIDI sequence.
void midiStop()Stops playing a MIDI sequence.
void updateMidi()MIDI sequence must be updated at a rate of 24 pulses per quarter note. The ClockStep template in MEAP_MIDI_TEMPLATE_WITH_CLOCK.ino can be used for this.
void flush()Sends note off messages to all voices.