MIDI (vuo.midi)
Nodes for sending and receiving MIDI notes and other MIDI messages (MIDI events).
A MIDI input device (such as a keyboard, controller, or sequencer) can send MIDI messages to the Receive MIDI Events node, allowing the device to control the composition.
A MIDI output device (such as a synthesizer, sequencer, or stage lighting equipment) can receive MIDI messages from the Send MIDI Event node, allowing the composition to control the device.
Each MIDI device has a unique ID, which is assigned by the operating system. If all devices were plugged in after the computer started up, then ID 0 is usually the first device plugged in, ID 1 is usually the second device plugged in, etc.
Each MIDI device has a name, which is not necessarily unique. On macOS, you can look up a device’s name in the Audio MIDI Setup application.
A MIDI note message often represents a musical note. It includes:
- A note number, ranging from 0 to 127. This often represents the pitch of the note, with Middle C (C4) at 60.
- A velocity, ranging from 0 to 127. This often represents the force with which the note is played.
- Whether this is a Note On or a Note Off message. A Note On message represents that a note is pressed (started). A Note Off message represents that a note is released (ended).
A MIDI controller message often represents a musical effect (volume, panning, filter cutoff, sustain, etc.). A controller message can be sent by a control on a MIDI device (knob, fader, pedal, etc.). It includes:
- A controller number, ranging from 0 to 127. This often represents the type of effect.
- A controller value, ranging from 0 to 127. This often represents amount of the effect. Some effects use the whole range of values, while others are either on (0-63) or off (64-127).
A MIDI pitch bend message often represents a change in the relative pitch of all notes on a certain MIDI channel. Its value ranges from 0 to 16,383, with 8,192 being the center point (no pitch change). The pitch bend range varies per device and configuration, but often the full range covers a whole tone (value 0 is 2 semitones down, value 16,383 is 2 semitones up).
MIDI note, controller, and pitch bend messages also include:
- A channel, ranging from 1 to 16. Each channel has its own stream of MIDI notes and controller values. A channel often represents one musical instrument.
You can send MIDI messages between two Vuo compositions, one with a Send MIDI Event node and the other with a Receive MIDI Events node. For this to work, you need to set up a MIDI device that supports both input and output. The compositions will communicate through this device. On macOS, you can set up the device like this: open the Audio MIDI Setup application and go to the MIDI window, double-click on the IAC driver, and check the box for “Device is online”. Then run the compositions.
Example compositions:
- Animate for MIDI Note: Flashes the small square whenever any MIDI note is received and while the note is held, and plays a special animation when the C#5 (just above middle C) is received.
- Receive MIDI Notes: Receives MIDI notes and pitch bend messages from MIDI Channel 1 of the default MIDI device and plays them aloud.
- Send MIDI Notes: Sends random MIDI notes to a MIDI device.
This composition by itself doesn't play sound. To play sound, you can use MIDI hardware or follow the instructions in the vuo.midi documentation to use another Vuo composition such as Receive MIDI Notes.
- Show Piano Roll: Receives MIDI notes from a MIDI device and displays them like a player-piano-style piano roll.
The note number controls the horizontal position where the note is drawn. The note velocity controls the color.
Thanks to George Toledo for the velocity coloring.
Nodes:
- Convert Note to Frequency (vuo.midi.note.frequency): Outputs the frequency associated with a MIDI note number.
- Filter Controller (vuo.midi.filter.controller): Only lets a MIDI controller pass through if its channel and controller number match.
- Filter Note (vuo.midi.filter.note): Only lets a MIDI note pass through if its channel and note number match.
- Filter Pitch Bend (vuo.midi.filter.pitchBend): Only lets a MIDI pitch bend pass through if its channel matches.
- Filter and Smooth Controller (vuo.midi.smooth.controller): Only lets a MIDI controller pass through if its channel and controller number match.
- Get Controller Values (vuo.midi.get.controller): Gives the components of a MIDI controller message.
- Get MIDI Input Values (vuo.midi.get.input): Gives information about a MIDI input device.
- Get MIDI Output Values (vuo.midi.get.output): Gives information about a MIDI output device.
- Get Note Values (vuo.midi.get.note): Gives the components of a MIDI note message.
- Get Pitch Bend Values (vuo.midi.get.pitchBend): Gives the components of a MIDI pitch bend message.
- List MIDI Devices (vuo.midi.listDevices2): Gives a list of all available MIDI input and output devices.
- Make Controller (vuo.midi.make.controller): Creates a MIDI controller message that can be sent to a MIDI device.
- Make Note (vuo.midi.make.note): Creates a MIDI note message that can be sent to a MIDI device.
- Make Pitch Bend (vuo.midi.make.pitchBend): Creates a MIDI pitch bend message that can be sent to a MIDI device.
- Receive MIDI Events (vuo.midi.receive): Fires events when MIDI messages are received from an input device.
- Send MIDI Event (vuo.midi.send): Sends a MIDI message to an output device.
- Specify MIDI Input by ID (vuo.midi.make.input.id): Finds a MIDI input device that is connected to the computer running the composition.
- Specify MIDI Input by Name (vuo.midi.make.input.name): Finds a MIDI input device that is connected to the computer running the composition.
- Specify MIDI Output by ID (vuo.midi.make.output.id): Finds a MIDI output device that is connected to the computer running the composition.
- Specify MIDI Output by Name (vuo.midi.make.output.name): Finds a MIDI output device that is connected to the computer running the composition.
- Track Notes (vuo.midi.track.note.poly): Outputs a list of the MIDI notes that are currently on.
- Track Single Note (vuo.midi.track.note.mono): Chooses a single MIDI note of the notes that are currently on, based on a note priority rule.