toki_pona/tts_tr.sh
2024-04-10 07:27:09 +02:00

18 lines
768 B
Bash
Executable File

#!/bin/bash
set -x
set -e
# generate silence
# sox -n -r 22050 silence_500.wav trim 0.0 0.500
python3 lexconvert.py --phones2phones unicode-ipa espeak "${1}. a." | espeak -g 1 -s 1 -v en+f4 -w "tts/tok_words/${3}.wav"
duration=`ffprobe -v error -show_entries format=duration -of csv=p=0 tts/tok_words/${3}.wav`
duration=`echo $duration - 1.55 | bc`
ffmpeg -y -ss 00:00:00 -to "$duration" -i "tts/tok_words/${3}.wav" -c copy "tts/tok_words/${3}_fixed.wav"
rm "tts/tok_words/${3}.wav"
echo "${2}" | espeak -v en+m4 -w "tts/tok_words/${3}_tr.wav"
sox "tts/tok_words/${3}_fixed.wav" "tts/tok_words/silence_500.wav" "tts/tok_words/${3}_tr.wav" "tts/tok_words/${3}_fixed.wav" "tts/tok_words/${3}_final.wav"
rm "tts/tok_words/${3}_fixed.wav" "tts/tok_words/${3}_tr.wav"