ddwMIDI Guide:
Filter:
ddwMIDI/Guides (extension) | External Control > MIDI

ddwMIDI Guide
ExtensionExtension

General notes on ddwMIDI usage

Overview

The ddwMIDI Quark provides two main ways of working with MIDI information:

Sockets and controllers
Respond to MIDI note and controller data.
MIDIRecBuf and MIDIBufManager
Record, store and manipulate MIDI note data.

This document is intended to cover the main usage patterns. Implementation details may be found in the class references, linked in the text below.

Why another responder hierarchy?

The standard MIDI responders (MIDIFunc, MIDIdef) are organized around the incoming message type. The ddwMIDI responders are organized around what you want to do with the information. For example, if you want to play notes using a MIDI keyboard:

For another example, ddwChucklib can trigger processes using note-on messages. MTSocket makes the connection. Thus, the class of the responder explains how the incoming messages will behave (while, in the standard MIDI responders, you would have to inspect a function definition -- error prone, to say the least).

Sockets and controllers

ddwMIDI responders divide into two categories:

Sockets
Sockets handle note-on and note-off messages. Every socket is expected to respond to both on and off messages; that is, there is no need to create separate responders for them.
  • AbstractMIDISocket is the parent of all MIDI sockets. If you need a custom socket, inherit from this class.
  • BasicMIDISocket installs two functions (note-on and note-off), to handle any logic you like. The functions are passed |note, velocity| as arguments.
  • VoicerMIDISocket directs note-on and note-off messages to a Voicer. The Voicer handles node allocation and voice-stealing.
  • MIDIThruSocket passes note messages to another MIDI channel, with optional pre-processing. The forwarded messages are sent through MIDIIn, so they can be received by MIDIFunc/MIDIdef as well as other ddwMIDI responders.
  • MIDI2OSCSocket transmits note messages over OSC to SuperCollider running on a remote machine. Not extensively tested.
  • MIDIRecSocket records note data into a MIDIRecBuf.
Controllers
Controllers handle continuous-control, pitch-bend and aftertouch messages.
  • AbstractMIDIControl is the parent of all MIDI controller classes.
  • BasicMIDIControl installs a function. The function receives |value, divisor, ccnum| as arguments.
  • VoicerMIDIController connects control messages to a VoicerGlobalControl, which represents a control input that should apply to all synths played by the Voicer.
  • VoicerSusPedal makes a Voicer respond to the sustain footswitch.
  • MixerMIDIControl connects control messages to a MixerChannel's level control.
  • MIDIThruControl passes note messages to another MIDI channel.
  • MIDI2OSCControl transmits note messages over OSC to SuperCollider running on a remote machine. Not extensively tested.

Identifying MIDI channels

In ddwMIDI, specify the source of incoming messages in the following ways:

OBJECTMEANING
nilDefault MIDI device, channel 0
IntegerChannel number, assuming default MIDI device
\omniDefault MIDI device, any channel
Array [device, channel]The specified device and channel
Array [device, \omni]The specified device, any channel
Array [\all, channel]Any device, given channel
Array [\all, \omni]Any device, any channel

Notes:

Controller numbers

Controller numbers may be specified as follows:

OBJECTMEANING
IntegerThe controller number itself
\pbPitch-bend wheel
\touchAftertouch
\omniAny controller
\ptouchPoly-aftertouch
CControl instanceEncapsulate a physical control and an attached button

Time doesn't permit a full explanation of CControl in this draft. Soon...

NOTE: By default, continuous controllers do not respond until the incoming controller value either comes close to, or crosses, the existing value. This is to prevent the value in SuperCollider from jumping suddenly to a physical controller value that may be quite distant. You can disable this behavior globally by setting AbstractMIDIControl.syncByDefault = false. It is currently not supported to choose this behavior per responder.

Buffers of MIDI data

To be written later.

Examples

Basic usage of VoicerMIDISocket

Selecting a default MIDI device