Skip to content

Commit

Permalink
TTS speed hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
pyrater committed Jan 12, 2025
1 parent e53060f commit 09d5b44
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/module_piper.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ def py_error_handler(filename, line, function, err, fmt):
model_path = os.path.join(script_dir, 'tts/TARS.onnx')
model_path = os.path.normpath(model_path)

# Load the Piper model
voice = PiperVoice.load(model_path)

async def synthesize(voice, chunk):
"""
Synthesize a chunk of text into a BytesIO buffer.
Expand Down Expand Up @@ -56,8 +59,6 @@ async def text_to_speech_with_pipelining(text):
"""
Converts text to speech using the specified Piper model and streams audio playback with pipelining.
"""
# Load the Piper model
voice = PiperVoice.load(model_path)

# Split text into smaller chunks
chunks = re.split(r'(?<=\.)\s', text) # Split at sentence boundaries
Expand Down

0 comments on commit 09d5b44

Please sign in to comment.