aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/say
blob: 45376697b57805b962a5d24e19aa3074b0a0c6c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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";