To make the TTS speak numbers in a friendly way while still displaying the numeric values, you can use the following approaches:
1.
Custom Number-to-Words Conversion: Before sending the text to the TTS system, you can implement a function to convert numbers into words. For example, "$118,294.65" can be converted to "one hundred eighteen thousand two hundred ninety-four dollars sixty-five cents" for the TTS output, while keeping the numeric value for display purposes.
2.
Use SSML (Speech Synthesis Markup Language): Many TTS systems support SSML, which allows you to define how specific parts of the text should be spoken. You can use SSML to specify the spoken form of the numbers while keeping the numeric format for display.
3.
Provider-Specific Features: Some TTS providers offer built-in text normalization or pronunciation customization. Check if your TTS provider supports features like text normalization or custom pronunciation rules to handle numbers effectively.
These methods allow you to separate the visual representation of numbers from their spoken form, ensuring both are optimized for their respective purposes.
Sources:
Speechify TTS integration guide | LiveKit Docs |
tools/tts/tts.cpp |
Agent speech and audio | LiveKit Docs |
OpenAI TTS integration guide | LiveKit Docs |
Speech & Audio Processing | livekit/livekit_composite | DeepWiki