scripts-local-tts/speak.sh

29 lines
576 B
Bash
Raw Normal View History

2024-05-28 12:14:13 -04:00
#!/bin/bash
2024-05-28 12:49:59 -04:00
# https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video
2024-05-28 12:51:48 -04:00
# https://github.com/mozilla/TTS
2024-05-28 12:49:59 -04:00
#
2024-05-28 12:14:13 -04:00
if [ -z "$1" ]; then
echo usage: $0 \"text\" [tempo] [model]
exit
fi
STR=$1
MODEL="tts_models/en/jenny/jenny"
TEMPO=1.0
if [ -z "$2" ]; then
TEMPO=$TEMPO
else
TEMPO=$2
if [ -z "$3" ]; then
MODEL=$MODEL
else
MODEL=$3
fi
fi
tts --text "$STR" --model_name "$MODEL" && \
ffmpeg -i tts_output.wav -filter:a "atempo=$TEMPO" -vn ffmpeg_output.wav -y && \
ffplay ffmpeg_output.wav -nodisp -autoexit