You can use SCLOrkJack to manage and save Jack connections (audio and MIDI). It also contains a few built-in connection presets commonly used in SCLOrk.
The class assumes SuperCollider is running on a Linux computer with the Jack Audio Connection Kit handling both audio and MIDI (the default setup in the Santa Clara Laptop Orchestra). It assumes that ALSA MIDI connections are visible to Jack through the a2jmidid tool (in SCLOrk, our QJackCtl is set to run a2jmidid -e & at start up).
SCLOrkJack is inspired by jmess by Juan Pablo-Caceres and SCJConnection by Marije Baalman. Like SCJConnection, SCLOrkJack is an encapsulation of calls to the command line tools jack_connect, jack_disconnect, and jack_lsp.
Basic usage:
Lists all available ports, prepending "AUDIO:" or "MIDI:" before each line for convenience.
List all available ports but without prepending AUDIO: or MIDI: before each line.
Lists all available source ("readable") ports.
Lists all available destination ("writable") ports.
Lists all existing connections.
Lists all available ports and their respective properties (e.g., 'input' or 'output', 'physical', etc).
Lists all available ports and their respective types (e.g., '32 bit float mono audio', '8 bit raw midi').
Connects two ports.
from |
(String) A valid audio or MIDI port. |
to |
(String) A valid audio or MIDI port. |
Disconnects two ports.
from |
(String) A valid audio or MIDI port. |
to |
(String) A valid audio or MIDI port. |
Disconnects all current connections, audio and MIDI.
Opens a dialog box where you can specify file name and location to save the list of current connections. Contents of the file will simply be an Array. Use extension *.scd like any other SuperCollider file.
Make connections as specified in the file provided. Typically this will be a file you previously saved using saveCurrentConnections
.
path |
Optional path to the connections file you wish to load. If a path to a file is not provided, a dialog box will open to select one. |
Connects ports from given connections list (audio & midi).
saveCurrentConnections
to generate and save your connectionArray into a file, then copy the contents of the file and paste it directly as argument to this method.connectionArray |
A List or Array specifying ports to be connected. It should be organized this way: |
Allows user to recall connection presets that are commonly used in SCLOrk.
symbol |
A Symbol, name of the preset. Available presets are:
|
Returns an Array with all available ports.
an Array
Like collectPorts, but only returns ports that are sources ("readable"), not destinations ("writable").
an Array
Returns a list of connections. Each sub-array contains a source port (at index 0) followed by the destination port(s) connected to it.
jack_lsp -c
, which contains duplicate connections (i.e., both from>to and to>from are listed), this method returns a clean list with no duplicates.an Array of Arrays
Returns an Array of Arrays with all available ports and their types.
Returns an Array of Arrays with all ports and their corresponding properties.
Takes a port name as String; checks if it starts with "a2j"; if so, proceed to check whether there is an existing port on this machine that is essentially identical in name, except for possibly a different number in the middle.
a2j:nanoKONTROL2 [20] (capture): nanoKONTROL2 MIDI 1
on my machine, but a2j:nanoKONTROL2 [120] (capture): nanoKONTROL2 MIDI 1
on your machine. If you save connections from one machine and want to replicate them in other machines, this unexpected number change will lead to a failed connection. This method fixed that by comparing the two strings and returning the one that actually exists on the computer at hand.candidatePort |
The port name (as String) that you want to check. |
(String) the actual existing a2j port, if any; or just candidatePort if not a2j.
Returns an Array with all available a2j MIDI port names.
Returns true if the port name currently exists, false otherwise.
port |
A port name as a String |
a Boolean
Checks if MIDIClient.init has been initialized. If not, attempt to initialize it.
onComplete |
Function to be evaluated after MIDI has been initialized. |
lag |
How many seconds to wait for MIDIClient.init to finish initializing (default is 3). |