Here’s what I’ve come up with so far.
In /usr/lib/systemd/system, there are a number of relevant .service files. One of them is jack.service, which reads (I’m using gedit):
[Unit]
Description=JACK Server
After=sound.target
[Service]
LimitRTPRIO=infinity
LimitMEMLOCK=infinity
Environment=JACK_NO_AUDIO_RESERVATION=1
ExecStart=/usr/bin/jackd -v -t 2000 -P 75 -d alsa -d hw:pisound -r 48000 -p 128 -n 2 -X seq -s -S
[Install]
WantedBy=multi-user.target
I want to start pd-l2ork before jack is started, so that the MIDI connection from PD to touchosc is automatically made; in qjackctl that looks like this:
What I’ve tried so far, based on info I found on how things are done with systemd
, is make a file called puredata.service in /usr/lib/systemd/system with this content:
[Unit]
Description=Pure Data service
After=sound.target
[Service]
ExecStart=/usr/bin/pd-l2ork -rt -audiobuf 20 -inchannels 2 -outchannels 2 -alsamidi -mididev 0 %U
[Install]
WantedBy=multi-user.target
Note that I’ve taken over the After=sound.target from jack.service, and in that file changed it to After=puredata.service, so that the Puredata starts before jack does and Puredata’s MIDI output should be available in Jack.
After this, I’ve done:
sudo systemctl start puredata
sudo systemctl enable puredata
sudo systemctl stop puredata
which to my knowledge should make it available at boot.
It’s not working yet though… no PD at boot. Maybe I’m missing something?
Also, in a fresh boot, when I stop the jack service, then manually start puredata, then start the jack service again, the Puredata MIDI output is available in the ALSA MIDI Connection window, but I can’t get it to auto-connect to the touchosc input; even if I make a default patchbay for that connection and tick Activate Patchbay Persistence in qjackctl’s Setup - Options page.
Perhaps there is a different/better method of approaching all of this? Again, what I’m looking for is auto-starting a PD patch and have the PD MIDI output connected to the touchosc MIDI input.