Created
November 14, 2025 21:57
-
-
Save davidmezzetti/df748b16fd54160a2104fbd444590a43 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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