rosavox/source/scripts/generate-audio

28 lines
567 B
Bash
Executable file

#!/usr/bin/env bash
## functions
function syntaxerror
{
echo "SYNTAX: generate-audio <input-path> <output-path>"
}
## args
if [ $# -ge 1 ] ; then input_path=$1 && shift ; else syntaxerror ; fi
if [ $# -ge 1 ] ; then output_path=$1 && shift ; else syntaxerror ; fi
## vars
key=$(cat "${input_path}" | sha256sum | cut -d ' ' -f 1)
wav_path=/tmp/${key}.wav
## exec
cat ${input_path} | piper/piper --model piper/voice.onnx --output_file ${wav_path} > /dev/null
ffmpeg -loglevel error -y -i ${wav_path} -vn ${output_path}
rm -f ${wav_path}
echo ${output_path}