*****************************************************
pyttsx3 (offline TTS for Python 3)
*****************************************************
``pyttsx3`` is a text-to-speech conversion library in Python. Unlike alternative libraries, it works offline, and is compatible with both Python 2 and 3.
Installation
************
::
pip install pyttsx3
> If you get installation errors , make sure you first upgrade your wheel version using :
`pip install --upgrade wheel`
**Linux installation requirements :**
#####################################
+ If you are on a linux system and if the voice output is not working , then :
Install espeak , ffmpeg and libespeak1 as shown below:
::
sudo apt update && sudo apt install espeak ffmpeg libespeak1
Usage :
************
::
import pyttsx3
engine = pyttsx3.init()
engine.say("I will speak this text")
engine.runAndWait()
**Changing Voice , Rate and Volume :**
::
import pyttsx3
engine = pyttsx3.init() # object creation
""" RATE"""
rate = engine.getProperty('rate') # getting details of current speaking rate
print (rate) #printing current voice rate
engine.setProperty('rate', 125) # setting up new voice rate
"""VOLUME"""
volume = engine.getProperty('volume') #getting to know current volume level (min=0 and max=1)
print (volume) #printing current volume level
engine.setProperty('volume',1.0) # setting up volume level between 0 and 1
"""VOICE"""
voices = engine.getProperty('voices') #getting details of current voice
#engine.setProperty('voice', voices[0].id) #changing index, changes voices. o for male
engine.setProperty('voice', voices[1].id) #changing index, changes voices. 1 for female
engine.say("Hello World!")
engine.say('My current speaking rate is ' + str(rate))
engine.runAndWait()
engine.stop()
"""Saving Voice to a file"""
# On linux make sure that 'espeak' and 'ffmpeg' are installed
engine.save_to_file('Hello World', 'test.mp3')
engine.runAndWait()
**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:
**************
* PyPI (https://pypi.python.org)
* GitHub (https://github.com/nateshmbhat/pyttsx3)
* Full Documentation (https://pyttsx3.readthedocs.org)
Raw data
{
"_id": null,
"home_page": "https://github.com/nateshmbhat/pyttsx3",
"name": "pyttsx3",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "pyttsx, ivona, pyttsx for python3, TTS for python3, pyttsx3, text to speech for python, tts, text to speech, speech, speech synthesis, offline text to speech, offline tts, gtts",
"author": "Natesh M Bhat",
"author_email": "nateshmbhatofficial@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/be/2b/490f7d3fbbfa6e29959351fd4d84c570bc319eaa0570e6abc5d1ce2b7392/pyttsx3-2.98.tar.gz",
"platform": null,
"description": "*****************************************************\npyttsx3 (offline TTS for Python 3)\n*****************************************************\n\n``pyttsx3`` is a text-to-speech conversion library in Python. Unlike alternative libraries, it works offline, and is compatible with both Python 2 and 3.\n\nInstallation\n************\n::\n\n\tpip install pyttsx3\n\n\n> If you get installation errors , make sure you first upgrade your wheel version using : \n`pip install --upgrade wheel`\n\n**Linux installation requirements :**\n#####################################\n\n+ If you are on a linux system and if the voice output is not working , then : \n\nInstall espeak , ffmpeg and libespeak1 as shown below: \n\n::\n\n\tsudo apt update && sudo apt install espeak ffmpeg libespeak1\n\n\nUsage :\n************\n::\n\n\timport pyttsx3\n\tengine = pyttsx3.init()\n\tengine.say(\"I will speak this text\")\n\tengine.runAndWait()\n\t\n\t\n**Changing Voice , Rate and Volume :**\n\n::\n\n\timport pyttsx3\n\tengine = pyttsx3.init() # object creation\n\n\t\"\"\" RATE\"\"\"\n\trate = engine.getProperty('rate') # getting details of current speaking rate\n\tprint (rate) #printing current voice rate\n\tengine.setProperty('rate', 125) # setting up new voice rate\n\n\n\t\"\"\"VOLUME\"\"\"\n\tvolume = engine.getProperty('volume') #getting to know current volume level (min=0 and max=1)\n\tprint (volume) #printing current volume level\n\tengine.setProperty('volume',1.0) # setting up volume level between 0 and 1\n\n\t\"\"\"VOICE\"\"\"\n\tvoices = engine.getProperty('voices') #getting details of current voice\n\t#engine.setProperty('voice', voices[0].id) #changing index, changes voices. o for male\n\tengine.setProperty('voice', voices[1].id) #changing index, changes voices. 1 for female\n\n\tengine.say(\"Hello World!\")\n\tengine.say('My current speaking rate is ' + str(rate))\n\tengine.runAndWait()\n\tengine.stop()\n\n\t\"\"\"Saving Voice to a file\"\"\"\n\t# On linux make sure that 'espeak' and 'ffmpeg' are installed\n\tengine.save_to_file('Hello World', 'test.mp3')\n\tengine.runAndWait()\n\n\n**Full documentation of the Library**\n#####################################\n\nhttps://pyttsx3.readthedocs.io/en/latest/\n\n\nIncluded TTS engines:\n*********************\n* sapi5\n* nsss\n* espeak\n\nFeel free to wrap another text-to-speech engine for use with ``pyttsx3``.\n\nProject Links:\n**************\n\n* PyPI (https://pypi.python.org)\n* GitHub (https://github.com/nateshmbhat/pyttsx3)\n* Full Documentation (https://pyttsx3.readthedocs.org)\n",
"bugtrack_url": null,
"license": null,
"summary": "Text to Speech (TTS) library for Python 3. Works without internet connection or delay. Supports multiple TTS engines, including Sapi5, nsss, and espeak.",
"version": "2.98",
"project_urls": {
"Homepage": "https://github.com/nateshmbhat/pyttsx3"
},
"split_keywords": [
"pyttsx",
" ivona",
" pyttsx for python3",
" tts for python3",
" pyttsx3",
" text to speech for python",
" tts",
" text to speech",
" speech",
" speech synthesis",
" offline text to speech",
" offline tts",
" gtts"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "94dfe1584757c736c4fba09a3fb4f22fe625cc3367b06c6ece221e4b8c1e3023",
"md5": "7704fddeec258b64380f9ff6116f2482",
"sha256": "b3fb4ca4d5ae4f8e6836d6b37bf5fee0fd51d157ffa27fb9064be6e7be3da37a"
},
"downloads": -1,
"filename": "pyttsx3-2.98-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7704fddeec258b64380f9ff6116f2482",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 34786,
"upload_time": "2024-09-27T01:01:32",
"upload_time_iso_8601": "2024-09-27T01:01:32.295736Z",
"url": "https://files.pythonhosted.org/packages/94/df/e1584757c736c4fba09a3fb4f22fe625cc3367b06c6ece221e4b8c1e3023/pyttsx3-2.98-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "be2b490f7d3fbbfa6e29959351fd4d84c570bc319eaa0570e6abc5d1ce2b7392",
"md5": "c4dd84e0e47267921052a396f70f4460",
"sha256": "cc609466151d8c4a69c1c765a945f893c00c1fd2569c2db55e17dc22121e9162"
},
"downloads": -1,
"filename": "pyttsx3-2.98.tar.gz",
"has_sig": false,
"md5_digest": "c4dd84e0e47267921052a396f70f4460",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 32052,
"upload_time": "2024-09-27T01:01:33",
"upload_time_iso_8601": "2024-09-27T01:01:33.671949Z",
"url": "https://files.pythonhosted.org/packages/be/2b/490f7d3fbbfa6e29959351fd4d84c570bc319eaa0570e6abc5d1ce2b7392/pyttsx3-2.98.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-27 01:01:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "nateshmbhat",
"github_project": "pyttsx3",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "pyttsx3"
}