-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathwyoming-satellite-android
executable file
·59 lines (51 loc) · 2.07 KB
/
wyoming-satellite-android
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/data/data/com.termux/files/usr/bin/sh
export OWW_ENABLED=false
wlog() {
local message="$1"
echo "$message" 2>&1 | tee -a "$HOME/wyoming-satellite.log"
}
echo "" > "$HOME/wyoming-satellite.log"
#echo "" > "$HOME/wyoming-openwakeword.log"
wlog "$(date)"
wlog "Ensure sox is available..."
if ! command -v rec > /dev/null 2>&1 || ! command -v play > /dev/null 2>&1; then
wlog "sox was not found, installing it now..."
pkg install sox -y
if ! command -v rec > /dev/null 2>&1 || ! command -v play > /dev/null 2>&1; then
wlog "ERROR: Failed to install sox" >&2
exit 1
fi
fi
export TERMUX_INFO="$(termux-info)"
export MANUFACTURER_NAME="$(echo "$TERMUX_INFO" | grep -A 1 "Device manufacturer:" | tail -1)"
export MODEL_NAME="$(echo "$TERMUX_INFO" | grep -A 1 "Device model:" | tail -1)"
if [ "$MANUFACTURER_NAME $MODEL_NAME" = " " ]; then
export SATELLITE_NAME="Android Satellite"
else
export SATELLITE_NAME="Android Satellite - $MANUFACTURER_NAME $MODEL_NAME"
fi
if [ "$OWW_ENABLED" = "true" ]; then
export OWW_FLAGS="--wake-uri tcp://127.0.0.1:10400 --wake-word-name ok_nabu"
wlog "Enter wyoming-openwakeword directory..."
cd "$HOME/wyoming-openwakeword"
stdbuf -oL -eL python3 ./script/run --uri 'tcp://0.0.0.0:10400' --preload-model 'ok_nabu' --debug 2>&1 | tee -a "$HOME/wyoming-satellite.log" &
else
export OWW_FLAGS=""
fi
wlog "Enter wyoming-satellite directory..."
cd "$HOME/wyoming-satellite"
wlog "Ensure module-sles-source is loaded..."
if ! pactl list short modules | grep "module-sles-source" ; then
pactl load-module module-sles-source
fi
stdbuf -oL -eL python3 ./script/run \
--name "$SATELLITE_NAME" \
--uri 'tcp://0.0.0.0:10700' \
--mic-command 'rec -r 16000 -c 1 -b 16 -e signed-integer -t raw --no-show-progress -' \
--snd-command 'play -r 22050 -c 1 -b 16 -e signed-integer -t raw --no-show-progress -' \
--awake-wav ./sounds/awake.wav \
--done-wav ./sounds/done.wav \
--timer-finished-wav ./sounds/timer_finished.wav \
--timer-finished-wav-repeat 5 0.5 \
$OWW_FLAGS \
--debug 2>&1 | tee -a "$HOME/wyoming-satellite.log"