osamc.de/archiv/talk-mod-host-pisound-button/index.adoc

56 lines
1.9 KiB
Plaintext
Raw Permalink Normal View History

2024-01-27 21:17:21 +01:00
= mod-host vs Pisound button
:customcss: presentation.css
:source-highlighter: highlight.js
:linkattrs:
2024-01-29 22:04:11 +01:00
https://sonoj.org/[Sonoj Convention, window=_blank]
2024-01-27 21:17:21 +01:00
2024-01-29 22:04:11 +01:00
https://github.com/danielappelt[Daniel Appelt, window=_blank] / 2023-09-30
2024-01-27 21:17:21 +01:00
== Pisound & the button
[%step]
2024-01-29 22:04:11 +01:00
* https://blokas.io/pisound/[Pisound, window=_blank] is a sound card and MIDI interface for the Raspberry Pi
* It comes with one https://github.com/BlokasLabs/pisound/blob/master/pisound-btn/pisound.conf[configurable button, window=_blank]
* Bash scripts are used for button action (https://github.com/BlokasLabs/pisound/blob/master/scripts/pisound-btn/toggle_wifi_hotspot.sh[example,window=_blank])
2024-01-27 21:17:21 +01:00
== mod-host
[%step]
2024-01-29 22:04:11 +01:00
* https://github.com/moddevices/mod-host[mod-host, window=_blank] is an LV2 host for JACK, controllable via socket or command line
* https://github.com/moddevices/mod-ui[mod-ui, window=_blank] is started together with mod-host in MODEP
2024-01-27 21:17:21 +01:00
* mod-ui uses file socket to communicate with mod-host
== Problem
[%step]
* 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
[%step]
* Let Pisound button start/stop mod-host via web socket
2024-01-29 22:04:11 +01:00
* https://github.com/vi/websocat[websocat, window=_blank] is like netcat, curl and socat for WebSockets
2024-01-27 21:17:21 +01:00
* Example script to start/stop transport in mod-host
== Code
[source, bash]
----
#!/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
----