From 8e6f23f49b74184a16fe89087ada064713c0e67a Mon Sep 17 00:00:00 2001 From: bel Date: Sat, 1 Apr 2023 11:17:08 -0600 Subject: [PATCH] gui dependent yeah sure whatever --- git.d/stt.d | 2 +- server.sh | 31 ++++++++++++++++++++++--------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/git.d/stt.d b/git.d/stt.d index bb578e9..63fe8e7 160000 --- a/git.d/stt.d +++ b/git.d/stt.d @@ -1 +1 @@ -Subproject commit bb578e98f6a13978e2e9c02b03eb6c41f16fc17c +Subproject commit 63fe8e7e9e1c68fd3f284bac6666ae5e5f970b6b diff --git a/server.sh b/server.sh index 9b12926..592b8df 100644 --- a/server.sh +++ b/server.sh @@ -73,23 +73,43 @@ _stt() { if [ -n "$PIP" ]; then pip3 install -r ../../git.d/stt.d/rust-whisper.d/requirements.txt fi + + 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 + for i in $(pactl list short modules | grep secret | cut -f1); do pactl unload-module $i done 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 + 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 + read -p "pavucontrol to change input to $mic_name, ok? " log launching stt ( 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="$mic_name" + export MIC_NAME="${MIC_NAME:-pulse_monitor}" export MODEL=tiny.en export P=2 while ! python3 ../../git.d/stt.d/rust-whisper.d/hotwords.py; do @@ -99,13 +119,6 @@ _stt() { ) } -_snap() { - if ! which snap; then - sudo apt -y install snap - fi - snap "$@" -} - if [ "$0" == "$BASH_SOURCE" ]; then main "$@" fi