# /bin/bash main() { set -eo pipefail tty && read -p "git refresh? [yN] " a && test "$a" == "y" && ( git config --global credential.helper store git submodule init git pull --recurse-submodules --jobs=10 git submodule foreach git pull origin master ) _tts _stt _mayhem_party _discord _dolphin while read; do pkill -SIGUSR1 -f mayhem-party done } cleanup() { pkill -f larynx pkill -f hotwords.py pkill -f rust-whisper pkill -f mayhem-party pkill -f server-vm } cleanup trap cleanup EXIT log() { echo "$(date) > $*" >&2 } _discord() { read -p "pls start discord" } _dolphin() { read -p "pls start dolphin" } _mayhem_party() { log mayhem-party pushd ./git.d/mayhem-party.d go build popd log launching mayhem-party ( source ./config.d/mayhem-party.d/env.env ./git.d/mayhem-party.d/mayhem-party ) &> /tmp/mayhem-party.mayhem-party.log & } _tts() { log tts ( cd ./git.d/tts.d/larynx.d/ bash ./run.sh ) &> /tmp/mayhem-party.mayhem-party.log & } _stt() { log stt pushd ./git.d/stt.d/rust-whisper.d/ pip3 install -r ./requirements.txt log launching stt local device=$( pactl list \ | grep Monitor.Source \ | grep -v hdmi \ | awk "{print \$NF}" \ | head -n 1 ) ( echo "pcm.pulse_monitor {" echo " type pulse" echo " device $device" echo "}" echo "ctl.pulse_monitor {" echo " type pulse" echo " device $device" echo "}" ) | sudo tee /etc/asound.conf ( export HOME="$PWD/mnt.d/stt.d" mkdir -p "$HOME" cd "$HOME" export HOTWORDS=../../../config.d/mayhem-party.d/v01.yaml@.users[].state.gm.alias export MIC_TIMEOUT=2 export URL=http://localhost:17071/gm/rpc/broadcastSomeoneSaidAlias?message={{hotword}} export HEADERS=say="Eye herd {{hotword}}" export MIC_NAME=pulse_monitor export DEBUG=true export MODEL=tiny.en export P=2 python3 ./hotwords.py ) &> /tmp/mayhem-party.stt.log & popd } _snap() { if ! which snap; then sudo apt -y install snap fi snap "$@" } if [ "$0" == "$BASH_SOURCE" ]; then main "$@" fi