Skip to content

Commit 5d85fc7

Browse files
committed
Explicitly fallback to aplay, as speech dispatcher will still try to use paplay even if it isn't installed
1 parent d016119 commit 5d85fc7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/templates.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// If sox is available on the host system we use it to adjust pitch and rate
2-
// Otherwise, we pass the output unmodified to the PLAY_COMMAND, but adjust its
3-
// parameters based on whether it's likely to be aplay or paplay
2+
// Otherwise, we pass the output unmodified to either paplay or aplay depending
3+
// on what is available on the system.
44
const String modelTemplate = """
55
GenericExecuteSynth "if command -v sox > /dev/null; then\\
66
PROCESS=\\'sox -r SAMPLE_RATE -c 1 -b 16 -e signed-integer -t raw - -t wav - tempo \$RATE pitch \$PITCH norm\\'; OUTPUT=\\'\$PLAY_COMMAND\\';\\
7-
elif [[ \\'\$PLAY_COMMAND\\' == aplay*]]; then\\
8-
PROCESS=\\'cat\\'; OUTPUT=\\'\$PLAY_COMMAND -t raw -c 1 -r SAMPLE_RATE -f S16_LE\\';\\
9-
else\\
7+
elif command -v paplay > /dev/null; then\\
108
PROCESS=\\'cat\\'; OUTPUT=\\'\$PLAY_COMMAND --raw --channels 1 --rate SAMPLE_RATE\\';\\
9+
else\\
10+
PROCESS=\\'cat\\'; OUTPUT=\\'aplay -t raw -c 1 -r SAMPLE_RATE -f S16_LE\\';\\
1111
fi;\\
1212
echo \\'\$DATA\\' | PIPER_PATH --model MODEL_PATH --output_raw | \$PROCESS | \$OUTPUT;"
1313
GenericRateAdd 1

0 commit comments

Comments
 (0)