Skip to main content

Text to Speech (TTS) library for Python 3. Works without internet connection or delay. Supports multiple TTS engines, including Sapi5, nsss, and espeak.

Project description

Downloads Downloads

the code is mostly from pyttsx3.

only because the repo pyttsx3 does not update for years and some new feature i want is not here, i cloned this repo.

the changelog:

  1. add memory support for sapi5
  2. add memory support for espeak(espeak is not tested). eg:
b = BytesIO()
engine.save_to_file('i am Hello World', b)
engine.runAndWait()
  1. fix VoiceAge key error

  2. fix for sapi save_to_file when it run on machine without outputsream device.

  3. fix save_to_file does not work on mac os ventura error. --3.0.6

  4. add pitch support for sapi5(not tested yet). --3.0.8

  5. fix nsss engine: Import super from objc to fix AttributeError by @matt-oakes.

  6. add tts support: deep-learning text to voice backend:

just say:

engine = pyttsx4.init('coqui_ai_tts')
engine.say('this is an english text to voice test.')
engine.runAndWait()

cloning someones voice:

engine = pyttsx4.init('coqui_ai_tts')
engine.setProperty('speaker_wav', './someones_voice.wav')

engine.say('this is an english text to voice test.')
engine.runAndWait()

demo output:

NOTE:

if save_to_file with BytesIO, there is no wav header in the BytesIO. the format of the bytes data is that 2-bytes = one sample.

if you want to add a header, the format of the data is: 1-channel. 2-bytes of sample width. 22050-framerate.

how to add a wav header in memory:https://github.com/Jiangshan00001/pyttsx4/issues/2

how to use:

install:

pip install pyttsx4

use:

import pyttsx4
engine = pyttsx4.init()

the other usage is the same as the pyttsx3


Full documentation of the Library

https://pyttsx3.readthedocs.io/en/latest/

Included TTS engines:

  • sapi5
  • nsss
  • espeak

Feel free to wrap another text-to-speech engine for use with pyttsx3.

Project Links :

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pyttsx4-3.0.13-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

Details for the file pyttsx4-3.0.13-py3-none-any.whl.

File metadata

  • Download URL: pyttsx4-3.0.13-py3-none-any.whl
  • Upload date:
  • Size: 28.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.9

File hashes

Hashes for pyttsx4-3.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 9cfe67febd2c6cd5bf023e827cefb86adab252c9bebe74a8d3c74858acf34102
MD5 2e20335f67af2958aab0a284711bab5c
BLAKE2b-256 d49eab8d59219bb43e0ded4ab2f4e3fbbda7300bda6deacee062adf28526d228

See more details on using hashes here.

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