#!/bin/bash source .env if [ "$ENABLE_TTS" = 1 ]; then echo "Installing piper for text to voice conversion..." echo "Downloading piper v0.0.2.." wget -q https://github.com/rhasspy/piper/releases/download/v0.0.2/piper_amd64.tar.gz echo "Extracting piper" tar -xf piper_amd64.tar.gz echo "Installing piper" rm -rf piper_amd64 rm piper_amd64.tar.gz chmod -R 777 ./piper/ mkdir piper/voices echo "Downloading tts voices from VOICE_LANGUAGE_LIST..." echo "This can take a while..." # Check if "en" is in $VOICE_LANGUAGE_LIST and download the english voice from the repo for lang in $(echo $VOICE_LANGUAGE_LIST | tr "," " "); do if [ "$lang" = "en" ] ; then echo "Downloading english voice..." wget -q https://github.com/rhasspy/piper/releases/download/v0.0.2/voice-en-us-ryan-high.tar.gz tar -xf voice-en-us-ryan-high.tar.gz mv en-us-ryan-high.onnx en.onnx mv en-us-ryan-high.onnx.json en.onnx.json rm -rf voice-en-us-ryan-high.tar.gz echo "Done" fi if [ "$lang" = "es" ] ; then echo "Downloading spanish voice..." wget -q https://github.com/rhasspy/piper/releases/download/v0.0.2/voice-es-mls_10246-low.tar.gz tar -xf voice-es-mls_10246-low.tar.gz mv es-mls_10246-low.onnx es.onnx mv es-mls_10246-low.onnx.json es.onnx.json rm -rf voice-es-mls_10246-low.tar.gz echo "Done" fi if [ "$lang" = "fr" ] ; then echo "Downloading french voice..." wget -q https://github.com/rhasspy/piper/releases/download/v0.0.2/voice-fr-siwis-medium.tar.gz tar -xf voice-fr-siwis-medium.tar.gz mv fr-siwis-medium.onnx fr.onnx mv fr-siwis-medium.onnx.json fr.onnx.json rm -rf voice-fr-siwis-medium.tar.gz echo "Done" fi if [ "$lang" = "it" ]; then echo "Downloading italian voice..." wget -q https://github.com/rhasspy/piper/releases/download/v0.0.2/voice-it-riccardo_fasol-x-low.tar.gz tar -xf voice-it-riccardo_fasol-x-low.tar.gz mv it-riccardo_fasol-x-low.onnx it.onnx mv it-riccardo_fasol-x-low.onnx.json it.onnx.json rm -rf voice-it-riccardo_fasol-x-low.tar.gz echo "Done" fi if [ "$lang" = "pt" ]; then echo "Downloading portuguese voice..." wget -q https://github.com/rhasspy/piper/releases/download/v0.0.2/voice-pt-br-edresson-low.tar.gz tar -xf voice-pt-br-edresson-low.tar.gz mv pt-br-edresson-low.onnx pt.onnx mv pt-br-edresson-low.onnx.json pt.onnx.json rm -rf voice-pt-br-edresson-low.tar.gz echo "Done" fi if [ "$lang" = "ca" ] ; then echo "Downloading catalan voice..." wget -q https://github.com/rhasspy/piper/releases/download/v0.0.2/voice-ca-upc_ona-x-low.tar.gz tar -xf voice-ca-upc_ona-x-low.tar.gz mv ca-upc_ona-x-low.onnx ca.onnx mv ca-upc_ona-x-low.onnx.json ca.onnx.json rm -rf voice-ca-upc_ona-x-low.tar.gz echo "Done" fi done echo "Moving voices to piper/voices/" mv *.onnx* piper/voices/ echo "Done. Piper installed!" else echo "TTS Disabled. No work to do..." fi