User Guide

Ruby Component
MIDI
When you send MIDI data to a Ruby component it is represented by an instance of the MIDI class. Using Ruby you are then free to process
this MIDI object in any way you like. You can create new MIDI objects and you can send objects out of the Ruby component to play a synth
in your schematic or somewhere else.
Reading MIDI Objects
The MIDI class is a very straightforward. A single instance of the class represents one individual MIDI message. FlowBotics Studio handles
MIDI channel messages and MIDI system exclusive messages.
MIDI Channel Messages
MIDI channel messages are defined by four properties:
Status - the type of message eg. note on, program change etc.
Channel - the MIDI channel on which the message was transmitted (1-16)
Data1 - first piece of status dependent data associated with the message
Data2 - second piece of status dependent data associated with the message
We won't go into the MIDI specification in any great detail here. If you're not familiar with it then there are plenty of good resources online.
To look access these properties for a MIDI object, call the to_array method. This will give you a ruby array with the above properties as the
elements, listed in order.
In the above example we're playing a middle C. You can see that the MIDI message shows 144 for the status (ie. NOTE ON) and 1 for the
MIDI channel. For MIDI note on and off messages Data1 gives you the note number (60 = middle C) and Data2 gives you the velocity (127 is
maximum velocity).
MIDI System Exclusive
MIDI system exclusive messages (or sysex for short) are single chunks of data expressed in hexadecimal (Hex) form. A sysex hex string
starts with F0 and is terminated by F7. The data in between can represent mostly anything that a synth manufacturer may want to send or
receive from their MIDI device.
Again, we won't go into the details of sysex here, we'll just explain how you can manipulate it within a Ruby component.
162 of 212