Closed gavtography closed 1 year ago
Please see the code example here: https://github.com/rhasspy/piper/blob/master/src/python_run/piper/__main__.py
This became easier with piper-tts package - https://pypi.org/project/piper-tts/ (python 3.9+ required). I've tried only on linux so I am not sure if it works on windows, but code is simple:
import piper
import wave
voice = piper.PiperVoice.load(model_path='/path/to/model.onnx', config_path='/path/to/config.json')
with open('/output/path/hello.wav' 'wb') as f:
with wave.Wave_write(f) as wav:
voice.synthesize('Your text here.', wav)
The documentation is a bit unclear. I want to simply have a python script where I input the speaker model, then the text I want it to say, then it spits the audio file on my desktop for testing purposes. This would be on Windows. Unfortunately I find the documentation to be a bit vague or lacking in detail. Any help would be appreciated, thanks!