Skip to content

Instantly share code, notes, and snippets.

@davidmezzetti
Created November 14, 2025 21:57
Show Gist options
  • Select an option

  • Save davidmezzetti/df748b16fd54160a2104fbd444590a43 to your computer and use it in GitHub Desktop.

Select an option

Save davidmezzetti/df748b16fd54160a2104fbd444590a43 to your computer and use it in GitHub Desktop.
import soundfile as sf
from txtai.pipeline import TextToSpeech
# Build pipeline
tts = TextToSpeech("neuml/kokoro-int8-onnx")
# Generate speech
speech, rate = tts(
"""Have you ever considered having a snooty British accent?
Well of course TxtAI has a pipeline for that.""",
speaker="bm_lewis"
)
# Write to file
sf.write("out.wav", speech, rate)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment