Initializing a MIDI connection

To establish the connection to a MIDI device, I am putting this in my SC startup file

( s.reboot {  ...
  s.waitForBoot { ...
                ~midiOut = MIDIOut.newByName("electribe2", "electribe2 electribe2 _ SOUND");
                ~dirt.soundLibrary.addMIDI(\midi, ~midiOut);
                ~midiOut.latency = 0.45;

because that's what I infer from MIDI | Tidal Cycles

It works, but these observations don't seem to match up:

  • SC will complain if the device name is wrong, or the device is not present
  • with correct name, SC will still not set up the connection - I have to do this in the ALSA tab of qjackctl. I am using pipewire-jack-audio-connection-kit (Fedora 35).

I would much prefer to not touch startup.scd at all, and

  • just use qjackctl or jack_connect, or
  • establish MIDI connection via a Tidal command (only).

Is this possible?

1 Like

I now think one can write ~midiOut =; to address the MIDI port that appears in qjackctl (cf. MIDIOut | SuperCollider 3.12.2 Help)

FWIW I create multiple virtual midi devices in alsa/JACK, then they are permanently available/mapped in supercollider.

I then just route the virtual ports in qjackctl (or other) wherever I want them to go

$ cat /etc/modprobe.d/midi-virt.conf 
options snd-seq-dummy ports=4

In my startup.scd:

        // midi

            ~midithroughport0 = MIDIOut.newByName("Midi Through", "Midi Through Port-0");
            ~midithroughport0.latency = 0;
            ~dirt.soundLibrary.addMIDI(\midi0, ~midithroughport0);

            ~midithroughport1 = MIDIOut.newByName("Midi Through", "Midi Through Port-1");
            ~midithroughport1.latency = 0;
            ~dirt.soundLibrary.addMIDI(\midi1, ~midithroughport1);


1 Like