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 different TTS engines, including Google Text-to-Speech (gTTS) and Wit.ai Text-to-Speech (Wit TTS).
Installation
You can install speech-engine
using pip:
pip install speech-engine
Usage
TTS_GOOGLE
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)
TTS_Witai
from speech_engine import TTS_Witai, InvalidTokenError, FileExtensionError
# Instantiate TTS_Witai with the Wit.ai auth token
tts = TTS_Witai(authToken)
# Check if the provided token is valid
if not tts.is_valid_token:
raise InvalidTokenError()
# Set the voice
tts.voice = 'Colin'
# 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)
# Get available voices
voices = tts.get_voices()
print(voices)
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
speech_engine-0.0.2.tar.gz
(3.4 kB
view details)
Built Distribution
File details
Details for the file speech_engine-0.0.2.tar.gz
.
File metadata
- Download URL: speech_engine-0.0.2.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eec1eba39f8fd4bae0bf17b33f2aed0f2763881d89519b28cded80b329c07b9f |
|
MD5 | 524e2ae057506a0e4c2b2f23386ea799 |
|
BLAKE2b-256 | 60726390c798401ecf2f92fdf3bcfdd5b4b8abc10194780328e721663476b7e1 |
Provenance
File details
Details for the file speech_engine-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: speech_engine-0.0.2-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fae559eb04a866c9461b05f275d2b53fb12b35ad38c388d1fc156c882bbfa763 |
|
MD5 | 4348becfc084d89133714cb52d32e1ed |
|
BLAKE2b-256 | ed5e133d635b140c816ff5605bb206bf3c27c4f9428e4c0b6b94be75ca41a464 |