mod-host vs Pisound button

Pisound & the button

mod-host

  • mod-host is an LV2 host for JACK, controllable via socket or command line

  • mod-ui is started together with mod-host in MODEP

  • mod-ui uses file socket to communicate with mod-host

Problem

  • Syncing mod-host as secondary via MIDI clock was unreliable

  • How to start/stop transport in mod-host as MIDI clock primary not using mod-ui?

Solution

  • Let Pisound button start/stop mod-host via web socket

  • websocat is like netcat, curl and socat for WebSockets

  • Example script to start/stop transport in mod-host

Code

#!/bin/sh

. /usr/local/pisound/scripts/common/common.sh

# Use websocket interface to mod-ui as the regular socket is exclusively used for
# communication between mod-ui and mod-host.

if [ -z $(echo -n '' | /usr/local/bin/websocat --text ws://127.0.0.1:80/websocket/ | grep 'transport 1') ]; then
    # Start transport and blinking
    echo 'transport-rolling 1' | /usr/local/bin/websocat ws://127.0.0.1:80/websocket/
else
    # Stop transport and blinking
    echo 'transport-rolling 0' | /usr/local/bin/websocat ws://127.0.0.1:80/websocket/
fi