diff --git a/git.d/stt.d b/git.d/stt.d index 465193b..bb578e9 160000 --- a/git.d/stt.d +++ b/git.d/stt.d @@ -1 +1 @@ -Subproject commit 465193b60d8bbfc7668db79ba65dd5c9a6833282 +Subproject commit bb578e98f6a13978e2e9c02b03eb6c41f16fc17c diff --git a/server.sh b/server.sh index 06a8dc3..9b12926 100644 --- a/server.sh +++ b/server.sh @@ -9,23 +9,26 @@ main() { git submodule foreach git pull origin master ) _tts - _stt _mayhem_party _discord + _stt _dolphin while read; do pkill -SIGUSR1 -f mayhem-party done } -cleanup() { +_cleanup() { pkill -f larynx pkill -f hotwords.py pkill -f rust-whisper pkill -f mayhem-party - pkill -f server-vm } -cleanup +cleanup() { + pkill -f server.sh + _cleanup +} +_cleanup trap cleanup EXIT log() { @@ -73,28 +76,11 @@ _stt() { for i in $(pactl list short modules | grep secret | cut -f1); do pactl unload-module $i done - 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 - name='my_secret_sink' if ! pactl list | grep -q $name; then pactl load-module module-null-sink sink_name=$name channels=1 pactl load-module module-remap-source master=$name.monitor source_name=shared-$name source_properties="device.description=shared-$name" channels=1 + mic_name="$(pactl list | grep -A 100 Name:.$name.monitor | grep device.description.=. | head -n 1 | sed 's/.* = //' | tr -d '"') Monitor" fi log launching stt @@ -103,10 +89,12 @@ _stt() { export MIC_TIMEOUT=2 export URL=http://localhost:17071/gm/rpc/broadcastSomeoneSaidAlias?message={{hotword}} export HEADERS=say="Eye herd {{hotword}}" - export MIC_NAME="${MIC_NAME:-$mic_name}" + export MIC_NAME="$mic_name" export MODEL=tiny.en export P=2 - python3 ../../git.d/stt.d/rust-whisper.d/hotwords.py + while ! python3 ../../git.d/stt.d/rust-whisper.d/hotwords.py; do + sleep 5 + done ) & ) }