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 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.wav")


# 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)

TTS_Deepgram

from speech_engine import TTS_Deepgram

# Instantiate TTS_Openai with the Openai Api key
tts = TTS_Deepgram(your_apikey)

# Set the voice
tts.set_voice('aura-angus-en')

# Synthesize and play speech
tts.speak("Hello, world!")

# Synthesize and save speech as an audio file
tts.save("Hello, world!", "output.wav")


# 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


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.2.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

speech_engine-0.2.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file speech_engine-0.2.0.tar.gz.

File metadata

  • Download URL: speech_engine-0.2.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for speech_engine-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e63fcc2ac5602520158606252ce4e33cb4caf324a031dde08edd3b334934963f
MD5 18e477567a0e68dcac71222b95a79a56
BLAKE2b-256 fb6273d0a0cacbd54b2a1d9ded3568e0766ecf989cdb14c967bed6a4133b1b10

See more details on using hashes here.

File details

Details for the file speech_engine-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: speech_engine-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for speech_engine-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 63a5749df2ffd6e83c903396028b2e67cf2089c1aefafc53798d10c4987fefc5
MD5 f26866ccfb5631f5546f3c6811398fa1
BLAKE2b-256 5ee639454643b2f9195dbafcade6917dd3d89d4b4ba29a7ae828d482df5fd0c4

See more details on using hashes here.

Supported by

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