Compare commits
10 commits
7dafdfef40
...
5b6d353987
Author | SHA1 | Date | |
---|---|---|---|
5b6d353987 | |||
e7d8f073a4 | |||
50b4ecf44b | |||
5354f40f4a | |||
7a1a56140d | |||
3bb27c3616 | |||
b697b70db1 | |||
295daab9ab | |||
28d8e3994f | |||
817467a20d |
11 changed files with 129 additions and 69 deletions
|
@ -1,3 +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)
|
||||
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
35
bypass.sh
|
@ -1,35 +0,0 @@
|
|||
#!/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"
|
12
config.env
12
config.env
|
@ -1,6 +1,8 @@
|
|||
FONT_BOLD=$(tput bold)
|
||||
FONT_NORMAL=$(tput sgr0)
|
||||
export TERM=xterm
|
||||
|
||||
PBC_PROTOCOL="http"
|
||||
PBC_HOST="192.168.1.24"
|
||||
PBC_PORT="3000"
|
||||
export FONT_BOLD=$(tput bold)
|
||||
export FONT_NORMAL=$(tput sgr0)
|
||||
|
||||
export PBC_PROTOCOL="http"
|
||||
export PBC_HOST="192.168.1.24"
|
||||
export PBC_PORT="3000"
|
|
@ -1,8 +0,0 @@
|
|||
#!/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"
|
||||
|
22
send-midi.sh
Executable file
22
send-midi.sh
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||
# license: MIT
|
||||
|
||||
dir="$(dirname $(realpath "$0"))"
|
||||
|
||||
. "$dir/config.env"
|
||||
|
||||
function checkVariable() {
|
||||
[[ -z "$1" ]] && printf "${FONT_BOLD}error: ${FONT_NORMAL}no $2 given\n" && exit 1
|
||||
! [ "$1" -eq "$1" ] 2> /dev/null && printf "${FONT_BOLD}error: ${FONT_NORMAL}given $2 \'$1\' is not a number\n" && exit 1
|
||||
}
|
||||
|
||||
checkVariable "$1" "midi channel"
|
||||
checkVariable "$2" "midi controller"
|
||||
checkVariable "$3" "value"
|
||||
|
||||
url="$(""$dir"/url.sh" "/midi")"
|
||||
|
||||
printf "> sending POST request to \'$url\'...${FONT_BOLD}"
|
||||
[ "$(curl -X POST -s -f -w "\n%{http_code}" "$url" -d "channel=$1" -d "controller=$2" -d "value=$3" | tail -n1)" -ne 200 ] && printf " error!\n" || printf " done!\n"
|
17
set-pedalboard.sh
Executable file
17
set-pedalboard.sh
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||
# license: MIT
|
||||
|
||||
set -e
|
||||
|
||||
dir="$(dirname $(realpath "$0"))"
|
||||
|
||||
. "$dir/config.env"
|
||||
|
||||
[[ -z "$1" ]] && printf "${FONT_BOLD}error: ${FONT_NORMAL}no pedalboard id given\n" && exit 1
|
||||
|
||||
url="$(""$dir"/url.sh" "/pedalboards" "$1")"
|
||||
|
||||
printf "> sending POST request to \'$url\'...${FONT_BOLD}"
|
||||
[ "$(curl -X POST -s -f -w "\n%{http_code}" "$url" | tail -n1)" -ne 200 ] && printf " error!\n" || printf " done!\n"
|
32
start-pedalboard.sh
Normal file → Executable file
32
start-pedalboard.sh
Normal file → Executable file
|
@ -1,50 +1,50 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>>>
|
||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||
# license: MIT
|
||||
|
||||
set -e
|
||||
|
||||
[[ "$EUID" != "0" ]] && printf "error: permission denied\n" && exit 1
|
||||
|
||||
source "./config.env"
|
||||
. "$(dirname $(realpath $0))/config.env"
|
||||
|
||||
printf "${FONT_BOLD}> starting pedalboard...${FONT_NORMAL}\n"
|
||||
printf "${FONT_BOLD}>>> starting pedalboard...${FONT_NORMAL}\n"
|
||||
|
||||
source "/usr/local/pisound/scripts/common/common.sh"
|
||||
. "/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 "> " && "/etc/velvettear/scripts/cpu-governor.sh" "performance"
|
||||
|
||||
printf ">>> starting MODEP..."
|
||||
patchbox module activate modep &>>> /dev/null
|
||||
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"
|
||||
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"
|
||||
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 "> 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 "> reloading systemd services..."
|
||||
systemctl daemon-reload &> /dev/null
|
||||
printf " done!\n"
|
||||
fi
|
||||
|
||||
printf ">>> starting pbc..."
|
||||
systemctl start pbc &>>> /dev/null
|
||||
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"
|
||||
printf "${FONT_BOLD}>>> started pedalboard after "$SECONDS" seconds${FONT_NORMAL}\n"
|
8
stop-pedalboard.sh
Normal file → Executable file
8
stop-pedalboard.sh
Normal file → Executable file
|
@ -7,11 +7,11 @@ set -e
|
|||
|
||||
[[ "$EUID" != "0" ]] && printf "error: permission denied\n" && exit 1
|
||||
|
||||
source "./config.env"
|
||||
. "$(dirname $(realpath $0))/config.env"
|
||||
|
||||
printf "${FONT_BOLD}> stopping pedalboard...${FONT_NORMAL}\n"
|
||||
printf "${FONT_BOLD}>>> stopping pedalboard...${FONT_NORMAL}\n"
|
||||
|
||||
source "/usr/local/pisound/scripts/common/common.sh"
|
||||
. "/usr/local/pisound/scripts/common/common.sh"
|
||||
|
||||
flash_leds 10
|
||||
sleep 0.25
|
||||
|
@ -33,4 +33,4 @@ printf "> " && "/etc/velvettear/scripts/cpu-governor.sh" "powersave"
|
|||
|
||||
flash_leds 100
|
||||
|
||||
printf "${FONT_BOLD}> stopped pedalboard after "$SECONDS" seconds${FONT_NORMAL}\n"
|
||||
printf "${FONT_BOLD}>>> stopped pedalboard after "$SECONDS" seconds${FONT_NORMAL}\n"
|
15
toggle-bypass.sh
Executable file
15
toggle-bypass.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||
# license: MIT
|
||||
|
||||
set -e
|
||||
|
||||
dir="$(dirname $(realpath "$0"))"
|
||||
|
||||
. "$dir/config.env"
|
||||
|
||||
url="$(""$dir"/url.sh" "/bypass" "$1")"
|
||||
|
||||
printf "> sending POST request to \'$url\'...${FONT_BOLD}"
|
||||
[ "$(curl -X POST -s -f -w "\n%{http_code}" "$url" | tail -n1)" -ne 200 ] && printf " error!\n" || printf " done!\n"
|
15
toggle-systemd.sh
Executable file
15
toggle-systemd.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||
# license: MIT
|
||||
|
||||
set -e
|
||||
|
||||
dir="$(dirname $(realpath "$0"))"
|
||||
|
||||
. "$dir/config.env"
|
||||
|
||||
url="$(""$dir"/url.sh" "/systemd" "$1")"
|
||||
|
||||
printf "> sending POST request to \'$url\'...${FONT_BOLD}"
|
||||
[ "$(curl -X POST -s -f -w "\n%{http_code}" "$url" -d "state=toggle" | tail -n1)" -ne 200 ] && printf " error!\n" || printf " done!\n"
|
32
url.sh
Executable file
32
url.sh
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||
# license: MIT
|
||||
|
||||
set -e
|
||||
|
||||
[[ -z "$1" ]] && printf "${FONT_BOLD}error:${FONT_NORMAL} no endpoint given\n" && exit 1
|
||||
url="$1"
|
||||
[[ "$url" != "/"* ]] && url="/$url"
|
||||
|
||||
if [[ "$2" ]]; then
|
||||
index="$2"
|
||||
[[ "$index" != "/"* ]] && index="/$index"
|
||||
fi
|
||||
url="$url$index"
|
||||
|
||||
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 "$url"
|
Loading…
Reference in a new issue