wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt-get update && \
sudo apt-get install -y dotnet-sdk-6.0
sudo apt-get update && \
sudo apt-get install -y aspnetcore-runtime-6.0
dotnet tool install --global Microsoft.CognitiveServices.Speech.CLI
mkdir -p $HOME/spx-data
docker run -it --entrypoint=/bin/bash -v $HOME/spx-data:/data --rm msftspeech/spx
spx config @key --set SPEECH-KEY
spx config @region --set SPEECH-REGION
For example:
spx synthesize --file </path/of/input/file> --voice zh-TW-HsiaoChenNeural --audio output </path/of/output/file>.mp3