Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

speech_engine-0.0.1.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

speech_engine-0.0.1-py3-none-any.whl (3.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page