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.set_language('en')
tts.set_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
# Instantiate TTS_Witai with the Wit.ai auth token
tts = TTS_Witai(your_authtoken)
# Set the voice
tts.set_voice('Colin')
# Synthesize and play speech
tts.speak("Hello, world!")
# Synthesize and save speech as an audio file
tts.save("Hello, world!", "output.mp3")
# Get available voices
voices = tts.get_voices()
print(voices)
TTS_Openai
from speech_engine import TTS_Openai
# Instantiate TTS_Openai with the Openai Api key
tts = TTS_Openai(your_apikey)
# Set the voice
tts.set_voice('alloy')
# Synthesize and play speech
tts.speak("Hello, world!")
# Synthesize and save speech as an audio file
tts.save("Hello, world!", "output.mp3")
# 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.1.0.tar.gz
(5.1 kB
view details)
Built Distribution
File details
Details for the file speech_engine-0.1.0.tar.gz
.
File metadata
- Download URL: speech_engine-0.1.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57e13a3cc07b9ceab58ee506b6192d826137b4ea357665668d45d1c01bb119e9 |
|
MD5 | 2a95a95e77ea3fd812dd0a5f969bd266 |
|
BLAKE2b-256 | 7855d8f93dd5d7f34824cd3a765b4a1706a37152476e0dbf9bc0669ff0d6be55 |
File details
Details for the file speech_engine-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: speech_engine-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ab8fbaafa87d53714bead5f224068e5b7da7989aaccc16dceddc137fa3fbebf |
|
MD5 | 69f0c0bd404799897473f9f9f771914b |
|
BLAKE2b-256 | e3954fc18a9103e76b424985fe5c27f9e266486c2267b1aa44a25641f24724bd |