Pattern Guide Cookbook 04: Sending MIDI:
Tutorials/A-Practical-Guide | Streams-Patterns-Events > A-Practical-Guide

Pattern Guide Cookbook 04: Sending MIDI

Sending notes under pattern control to MIDI devices

Sending MIDI out with Patterns

Sending MIDI is the job of the MIDIOut class and the \midi event type. A MIDIOut is created to talk to a hardware device; the MIDI channel is provided when an event is played. MIDIOut's newByName makes it easier to identify a device.

The \midi event type supports the following commands, chosen in the event by the \midicmd key: \allNotesOff, \bend, \control, \noteOff, \noteOn, \polyTouch, \program, \smpte, \songPtr, \sysex, \touch. The default is \noteOn. When playing a note (noteOn), by default the corresponding noteOff message will be sent after the note's sustain time.

If you want to synchronize events played by a MIDI device and events played by the SuperCollider server, the MIDIOut object's latency must match the server latency. You can set the latency any time to affect all future events.

Previous: Pattern Guide Cookbook 03: External Control

Next: Pattern Guide Cookbook 05: Using Samples