Skip to main content

A wrapper class to get started using Text To Speech quickly

Project description

Usage: noahs_tts

Getting Started

First, install the library:

pip install noahs_tts

Quick start

from noahs_tts import TTS  # if you saved the class in tts.py

tts = TTS()
tts.say("Hello world!")  # blocks until finished

Speak sentence-by-sentence (default) for snappier responsiveness:

tts.say("First sentence. Second sentence! Third sentence?")

Speak the whole string as one chunk:

tts.say("This will be spoken as a single utterance.", split_sentences=False)

Voice management

List available voices (id, name, locale, gender when available):

voices = tts.voices()
for v in voices:
    print(v["id"], v["name"], v["locale"], v["gender"])

Pick a voice by name or id (partial match allowed):

tts = TTS(voice="Zira")          # Windows example
tts = TTS(voice="Samantha")      # macOS example
tts = TTS(voice="english-us")    # Linux/eSpeak example

Control rate

Rate is engine-specific “words per minute” style. This wrapper casts to int.

tts = TTS(rate=180)      # set default on init
tts.say("Speaking at 180 wpm (approx).")

tts.say("Speed this one up.", split_sentences=False)

You can also override per-call when saving/synthesizing:

data = tts.synth("Faster line.", rate=220)

Save audio

Get WAV bytes:

wav_bytes = tts.synth("Save me to a file later.")
with open("out.wav", "wb") as f:
    f.write(wav_bytes)

Or save directly:

tts.save("Write this straight to disk.", "speech.wav", voice="Samantha", rate=170)

Check out Source Code

https://github.com/jonesnoah45010/noahs_tts

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

noahs_tts-0.1.0.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

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

noahs_tts-0.1.0-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file noahs_tts-0.1.0.tar.gz.

File metadata

  • Download URL: noahs_tts-0.1.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for noahs_tts-0.1.0.tar.gz
Algorithm Hash digest
SHA256 02fe288315e8f2c7ce6548683e4c56c789b29a109f6f2a51ee4f263940dea96c
MD5 5213f25f3b039408ce3dde6c7daf37f7
BLAKE2b-256 dc6b8b0f828ae0f9ed90d3bb673829f7d78fcb158fa6fda3a600ca26f096037c

See more details on using hashes here.

File details

Details for the file noahs_tts-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: noahs_tts-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for noahs_tts-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7593a925c1990130475b2ac4df47b415ee325f5e130501eb67102a21eda4a2c6
MD5 0cf6e3b1837b369469a0069405f8afd1
BLAKE2b-256 38007557368bb0c4cfe44ac4072c7f87b60c80c3915494a6fbd90011e9985e15

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