Skip to content

Python Package Help #326

Answered by zos474
zos474 asked this question in Q&A
Dec 23, 2023 · 1 comments · 5 replies
Discussion options

You must be logged in to vote

OK, thank goodness for codeium, I managed to figure it out and leaving this as a starter for others as new to this as I am...

import os
import wave
from piper.voice import PiperVoice

voicedir = os.path.expanduser('~/Documents/piper/') #Where onnx model files are stored on my machine
model = voicedir+"en_GB-alan-medium.onnx"
voice = PiperVoice.load(model)
wav_file = wave.open('output.wav', 'w')
text = "This is an example of text-to-speech using Piper TTS."
audio = voice.synthesize(text,wav_file)

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@slowrunner
Comment options

@JoseEliel
Comment options

@mitchind
Comment options

@mitchind
Comment options

@mitchind
Comment options

Answer selected by zos474
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants