telegramlib.text_to_speech¶
Text-to-Speech Conversion Module
This module provides functionality to convert text into spoken words using the Google Text-to-Speech (gTTS) library. It supports playing the generated speech audio, saving it in various formats, and removing the file after playback.
Usage Example¶
- Command-Line Usage:
`console python text_to_speech.py "Hello, World!" en `
The above command converts “Hello, World!” to speech in English.
- Function Usage:
The text_to_speech function can be used within other Python scripts to convert text to speech with custom options.
Example of converting text to speech and playing it:
`python text_to_speech(“Hello, how are you?”, play = True, remove = True) `
Functions
|
Main function that handles command-line arguments and invokes the text_to_speech function. |
|
Converts text to speech and handles audio file operations. |