Python package for synthesizing text into speech
Project description
speech_engine
speech_engine is a Python package that provides a simple interface for synthesizing text into speech using multiple .
Installation
You can install speech_engine
using pip:
pip install speech_engine
Usage
Basic Usage
from speech_engine import TTS_Google, FileExtensionError
# Instantiate TTS_Google
tts = TTS_Google()
# Set the language and other options
tts.lang = 'en'
tts.slow = False
# Synthesize and play speech
tts.speak("Hello, world!")
# Synthesize and save speech as an audio file
try:
tts.save("Hello, world!", "output.mp3")
except FileExtensionError as e:
print(e.message)
Customizing Options
You can customize various options of the TTS_Google class:
# Set the language
tts.lang = 'en'
# Set the top-level domain (optional)
tts.tld = 'com'
# Set the speech speed
tts.slow = False
Handling File Extension Errors
When using the save() method, if the provided filename does not have a .mp3 extension, a FileExtensionError will be raised. You can handle this exception as follows:
try:
tts.save("Hello, world!", "output.wav")
except FileExtensionError as e:
print(e.message)
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on GitHub.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for speech_engine-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 014a80fcbf134476dc879b99e1d4a1bafdca6e80f21c5eb85004f73b953590f4 |
|
MD5 | 264c968835f8564f4aede750e735f2f7 |
|
BLAKE2b-256 | 3f3d31d7b80226546e5518e70f58f094faaaf74da691e180eaba72ec1cb994eb |