Jamulus is a system for playing (aka “jamming”) with other musicians remotely. In these times of Covid-19, it has become quite popular, especially for band members that can no longer practice safely in person.
I have found that the PiSound/PatchBox system makes for a good platform to run Jamulus clients (and also to act as a server). As a dedicated machine for Jamulus, the connections have minimal latency, and seem to be quite stable, and appears (at least to me) to work with less Jack connection problems than using an external USB audio interface. The only disadvantage with PiSound is having only a single guitar jack input. If you are using an XLR microphone, you need external equipment to supply phantom power, make the impedance conversion, etc. I myself use an external mic preamp box for this.
As good as PiSound/PatchBox OS combination is for running Jamulus, the default configuration has one flaw. To use Jamulus properly, you must have any “direct-monitoring” turned off. That is, there should be no pathway from input to output that doesn’t flow through the Jamulus program. Problem is, the default configuration of PatchBox OS provides such a pathway. At boot-up, it apparently hooks up the Pulse Audio JACK source and sinks to the system capture and playback. These connections must be broken before starting up a Jamulus client.
Now, a person could manually remove these connections using, say, Patchage, or the jack_disconnect command line, or write a script that does this before starting the Jamulus client, and then restore the connections after Jamulus finishes (if you want things to go back to the “default way”.
QUESTION:
While a script like that above could work, I tried instead to create a custom patchbox module that I could select when I want to be in “Jamulus mode”. All the module does is disconnect the pulse audio connections at activation, and reconnect them upon deactivating the module. I got the module to install into the patchbox module system okay, as it does work in disconnecting the Pulse Audio upon activation, and reconnecting on deactivation.
The problem is, how do I get the Jamulus patchbox module to take effect at boot-time? Is that how modules work? The one you select in the Patchbox configuration gets activated at boot? Or do you have to manually do the selection after each boot?
If the former, (can be activated at boot), well, it doesn’t work for me. Here is my patchbox-module.json file:
{
"name": "jamulus",
"version": "1.0.0",
"description": "jamulus module",
"author": "bflamig",
"launch_mode": "auto",
"depends_on": [
"jack.service",
"pisound-ctl.service"
],
"scripts": {
"launch": "disconnect_pulse.sh",
"stop": "connect_pulse.sh"
}
}
where the disconnect and connect scripts call jack_disconnect and jack_connect as appropriate.
So am I on the right track here? Do I have the right dependencies?
Or is there a simpler way to do what I want: to make sure these auto-connections to pulse-audio don’t happen or are removed at boot time. I would like to setup PiSound boxes for a couple of non-technical band members. Having things just work out of the box would be desirable.
BTW: For those that are interested, my patchbox module source can be found on github at bflamig/jamulus-module. I welcome any better way to write this code.