initial commit
This commit is contained in:
commit
7dafdfef40
7 changed files with 158 additions and 0 deletions
20
LICENSE.md
Normal file
20
LICENSE.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
# MIT License
|
||||
**Copyright (c) 2022 Daniel Sommer \<daniel.sommer@velvettear.de\>**
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next
|
||||
paragraph) shall be included in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
**THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
||||
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.**
|
3
README.md
Normal file
3
README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# pedalboard-scripts
|
||||
|
||||
scripts to control [MODEP](https://blokas.io/modep/docs/) on a raspberry pi 4 with [pisound](https://blokas.io/pisound/) via [pbc](https://git.velvettear.de/velvettear/pbc.git)
|
35
bypass.sh
Normal file
35
bypass.sh
Normal file
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||
# license: MIT
|
||||
|
||||
[[ ! -f "./config.env" ]] && printf "error: file \'config.env\' does not exist\n" && exit 1
|
||||
source "./config.env"
|
||||
|
||||
url="/bypass"
|
||||
index="$1"
|
||||
if [[ "$index" ]] && [ "$index" -eq "$index" ] 2> /dev/null; then
|
||||
if [ "$index" -lt 0 ]; then
|
||||
index=0
|
||||
elif [ "$index" -gt 7 ]; then
|
||||
index=7
|
||||
fi
|
||||
url="$url/$index"
|
||||
fi
|
||||
|
||||
function checkVariable() {
|
||||
[[ "$1" ]] && return 0
|
||||
printf "error: variable"
|
||||
[[ "$2" ]] && printf " \'$2\'"
|
||||
printf " is not set\n"
|
||||
exit 1
|
||||
}
|
||||
|
||||
checkVariable "$PBC_PROTOCOL" "PBC_PROTOCOL"
|
||||
checkVariable "$PBC_HOST" "PBC_HOST"
|
||||
checkVariable "$PBC_PORT" "PBC_PORT"
|
||||
|
||||
url="$PBC_PROTOCOL://$PBC_HOST:$PBC_PORT$url"
|
||||
|
||||
printf "sending POST request: \'$url\'...${FONT_BOLD}"
|
||||
[ "$(curl -X POST -s -f -w "\n%{http_code}" "$url" | tail -n1)" -ne 200 ] && printf " error!\n" || printf " done!\n"
|
6
config.env
Normal file
6
config.env
Normal file
|
@ -0,0 +1,6 @@
|
|||
FONT_BOLD=$(tput bold)
|
||||
FONT_NORMAL=$(tput sgr0)
|
||||
|
||||
PBC_PROTOCOL="http"
|
||||
PBC_HOST="192.168.1.24"
|
||||
PBC_PORT="3000"
|
8
pedalboard.sh
Normal file
8
pedalboard.sh
Normal file
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||
# license: MIT
|
||||
|
||||
[[ ! -f "./config.env" ]] && printf "error: file \'config.env\' does not exist\n" && exit 1
|
||||
source "./config.env"
|
||||
|
50
start-pedalboard.sh
Normal file
50
start-pedalboard.sh
Normal file
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>>>
|
||||
# license: MIT
|
||||
|
||||
set -e
|
||||
|
||||
[[ "$EUID" != "0" ]] && printf "error: permission denied\n" && exit 1
|
||||
|
||||
source "./config.env"
|
||||
|
||||
printf "${FONT_BOLD}> starting pedalboard...${FONT_NORMAL}\n"
|
||||
|
||||
source "/usr/local/pisound/scripts/common/common.sh"
|
||||
|
||||
flash_leds 10
|
||||
sleep 0.25
|
||||
flash_leds 10
|
||||
|
||||
printf ">>> " && "/etc/velvettear/scripts/cpu-governor.sh" "performance"
|
||||
|
||||
printf ">>> starting MODEP..."
|
||||
patchbox module activate modep &>>> /dev/null
|
||||
printf " done!\n"
|
||||
|
||||
up="$(journalctl -u modep-touchosc2midi | tail -n1)"
|
||||
while [[ "$up" != *"Waiting for first package from touchOSC"* ]]; do
|
||||
printf ">>> waiting for touchosc2midi to come up...\n"
|
||||
sleep 0.1
|
||||
up="$(journalctl -u modep-touchosc2midi | tail -n1)"
|
||||
done
|
||||
printf ">>> sending message to touchosc2midi to wake it up...\n"
|
||||
oscsend localhost 12101 / m 000000b0
|
||||
|
||||
if [[ ! -e "/etc/systemd/system/pbc.service" ]]; then
|
||||
printf ">>> symlinking \'pbc.service\' to \'/etc/systemd/system\'..."
|
||||
ln -s "/opt/pbc/pbc.service" "/etc/systemd/system/pbc.service" &>>> /dev/null
|
||||
printf " done!\n"
|
||||
printf ">>> reloading systemd services..."
|
||||
systemctl daemon-reload &>>> /dev/null
|
||||
printf " done!\n"
|
||||
fi
|
||||
|
||||
printf ">>> starting pbc..."
|
||||
systemctl start pbc &>>> /dev/null
|
||||
printf " done!\n"
|
||||
|
||||
flash_leds 100
|
||||
|
||||
printf "${FONT_BOLD}> started pedalboard after "$SECONDS" seconds${FONT_NORMAL}\n"
|
36
stop-pedalboard.sh
Normal file
36
stop-pedalboard.sh
Normal file
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||
# license: MIT
|
||||
|
||||
set -e
|
||||
|
||||
[[ "$EUID" != "0" ]] && printf "error: permission denied\n" && exit 1
|
||||
|
||||
source "./config.env"
|
||||
|
||||
printf "${FONT_BOLD}> stopping pedalboard...${FONT_NORMAL}\n"
|
||||
|
||||
source "/usr/local/pisound/scripts/common/common.sh"
|
||||
|
||||
flash_leds 10
|
||||
sleep 0.25
|
||||
flash_leds 10
|
||||
|
||||
printf "> stopping pbc..."
|
||||
systemctl stop pbc &> /dev/null
|
||||
printf " done!\n"
|
||||
|
||||
printf "> stopping MODEP..."
|
||||
patchbox module deactivate &> /dev/null
|
||||
printf " done!\n"
|
||||
|
||||
printf "> stopping jack..."
|
||||
systemctl stop jack &> /dev/null
|
||||
printf " done!\n"
|
||||
|
||||
printf "> " && "/etc/velvettear/scripts/cpu-governor.sh" "powersave"
|
||||
|
||||
flash_leds 100
|
||||
|
||||
printf "${FONT_BOLD}> stopped pedalboard after "$SECONDS" seconds${FONT_NORMAL}\n"
|
Loading…
Reference in a new issue