aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/say
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/say')
-rwxr-xr-x.local/bin/say23
1 files changed, 23 insertions, 0 deletions
diff --git a/.local/bin/say b/.local/bin/say
new file mode 100755
index 0000000..4537669
--- /dev/null
+++ b/.local/bin/say
@@ -0,0 +1,23 @@
+#!/bin/sh -eu
+
+audio=/tmp/speak-jfgOUcZdWu.wav
+text=${1:-Nothing to say.}
+
+[ "${1-}" = "echo" ] && $0 "${2-}" "${1-}" && exit;
+
+printf '%s' "$text" |
+ piper \
+ --model "$HOME/.local/share/piper/voices/en_GB-jenny_dioco-medium.onnx" \
+ --output_file $audio
+
+[ "${2-}" = "echo" ] &&
+ ffmpeg \
+ -y \
+ -i "$audio" \
+ -map 0 \
+ -c:v copy \
+ -af aecho=1:1:50:0.5,atempo=0.85 "$audio.mp3" &&
+ mplayer -really-quiet "$audio.mp3" &&
+ exit;
+
+mplayer -really-quiet "$audio";