Page 1 of 1

Persistent Cadence Jack MIDI connections

Posted: Fri Jan 10, 2020 8:17 pm
by martibs
I have a home studio solution set up where I have a certain amount of hardware instruments hooked up to my computer, as well as a hardware MIDI sequencer to control all these devices, which is also connected to my computer via USB. I use Cadence to manage my Jack connections, and it works great. I establish the MIDI connections from my sequencer, and all is good:
Screenshot from 2020-01-10 21-11-15.png
I have all of my equipment hooked up to the same power supply, and turn all the gear off when I don't use it, except the computer. When I turn everything on again, both Cadence and Jack is still running, and the devices show up. The connections I made, however are lost, and I have to reconnect them again.
Now, it's not really that many reconnections to make, but it's still a bit of a drag, especially when the software connections are persistent when I stop and start the apps. Is there any way to make the hardware MIDI connections persist as well?

Re: Persistent Cadence Jack MIDI connections

Posted: Fri Mar 20, 2020 11:22 am
by martibs
In case anyone else is facing a similar issue, this is how I solved it. A simple python script hooks the defined connections up. I simply run the script ad hoc. (Needs Jack for Python:

Code: Select all


import jack
import re

# List of devices
pyramid = 'Pyramid MIDI USB'
keystep = 'Arturia KeyStep 32'
digitone = 'Elektron Digitone'
digitakt = 'Elektron Digitakt'
timefactor = 'TimeFactor Pedal'
lexicon = 'Lexicon MX400'

# List of connections, out to in
connection_list = [[pyramid, digitone],
    [pyramid, digitakt],
    [pyramid, timefactor],
    [pyramid, lexicon],
    [keystep, pyramid]]

client = jack.Client('MyJackClient')

myPorts = client.get_ports(is_midi=True)
for clist in connection_list:
    out_pattern = ".*" + clist[0] + ".*" + "capture"
    in_pattern = ".*" + clist[1] + ".*" + "playback"
    r_out = re.compile(out_pattern)
    r_in = re.compile(in_pattern)
    for midiout in myPorts:
        if r_out.match(str(midiout)):
            for midiin in myPorts:
                if r_in.match(str(midiin)):
                        client.connect(midiout, midiin)
                        print("Connected: \n" + str(midiout) + " -> " + str(midiin))
                    except jack.JackErrorCode:
                        print("Already connected: \n" + str(midiout) + " -> " + str(midiin))