• Stars
    star
    1,765
  • Rank 26,150 (Top 0.6 %)
  • Language
    Python
  • License
    Mozilla Public Li...
  • Created about 7 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Offline Text To Speech synthesis for python

Offline Text To Speech (TTS) converter for Python

Downloads Downloads

pyttsx3 is a text-to-speech conversion library in Python. Unlike alternative libraries, it works offline.

Buy me a coffee πŸ˜‡Buy me a coffee πŸ˜‡

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
    

Features :

  • ✨Fully OFFLINE text to speech conversion
  • 🎈 Choose among different voices installed in your system
  • πŸŽ› Control speed/rate of speech
  • 🎚 Tweak Volume
  • πŸ“€ Save the speech audio as a file
  • ❀️ Simple, powerful, & intuitive API

Usage :

import pyttsx3
engine = pyttsx3.init()
engine.say("I will speak this text")
engine.runAndWait()

Single line usage with speak function with default options

import pyttsx3
pyttsx3.speak("I will speak this text")

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 :

More Repositories

1

webbot

Web automation library for simple and easy end to end testing and web browser automation that offers super charged features while keeping it simple to use and master
Python
234
star
2

touchable

Flutter library to add gestures and animations to each Shape you draw on your canvas in your CustomPainter
Dart
218
star
3

electron-react-ts-starter

A solid :) boiler plate starter pack when starting an electron project which uses create-react-app with typescript.
TypeScript
111
star
4

card-scanner-flutter

A flutter package for Fast, Accurate and Secure Credit card & Debit card scanning
Swift
101
star
5

windows-terminal-tweaker

Tweak your windows terminal to heart's content with this app using its beautiful interface to configure everything about the terminal.
TypeScript
90
star
6

pyYify

This is a python library used to get the Top seeded torrents at any given time and get the entire movie details and ratings . Its also useful to search for any movie using different parameters and obtain their magnet link or torrent file of any preferred quality.
Python
56
star
7

svelte-ace

Ace Editor component for Svelte with TypeScript support πŸ₯³πŸ₯³
Svelte
43
star
8

rm-trash

A "rm-trash" is meant to be used in place of rm system command in linux . This script will safely delete your files and put them in the trash for later retrieval.
Shell
40
star
9

cardano-nft-minter

A script that handles minting cardano native tokens in a simple and interactive way.
Shell
29
star
10

tap-rpc

The tool you need for your GRPC clients and backends
TypeScript
25
star
11

torrento

A Dart package that wraps various Web Apis for controlling and managing torrent clients.
Dart
15
star
12

snakes

A LAN Multiplayer Snake game in C++ . This is a snake game which is a console based game written in C++ to which any number of players in LAN can join and play with their corresponding snakes with smooth synchronization.
C++
14
star
13

svelte-electron-ts-starter

This is a boiler plate starter pack when starting an electron project which uses svelte with typescript ⚑
TypeScript
10
star
14

tap-rest

TypeScript
9
star
15

coder-chat

A webapp built with react and express that is useful during coding sessions and other use cases that involve chatting and coding
TypeScript
6
star
16

flutter-snake-tutorial

Snake game made in flutter ! Hissss !
Dart
4
star
17

use-game-of-life

Demo of useGameOfLife
TypeScript
2
star
18

cns-lab-sit

Cryptography And Network Security Lab Programs
C++
2
star
19

flutter-multi-module-app

Sample multi module flutter app
Ruby
2
star
20

grpc-with-electron-sample-project

This project demonstrates an issue with grpc when run inside electron.
JavaScript
2
star
21

stream-it-android-app

Android app for streaming music on LAN.
Java
1
star
22

nateshmbhat

1
star
23

Regression

This repo contains many training models of Linear and Logistic regression implemented at lower level without using libraries like tensorflow.
Jupyter Notebook
1
star
24

Subtitle-grabber

Gets the subtitles for the video file or multiple videos in a specified directory.
Python
1
star
25

nateshmbhat.github.io

JavaScript
1
star
26

stream-it-desktop-app

The power to stream tons of music from your PCs onto your phones effortlessly.
Java
1
star
27

simple-countdown-timer

A countdown timer which is built to be used for a hackathon that we hosted.
JavaScript
1
star
28

dart-tutorial

Dart tutorial notes
1
star
29

timetable

Time table allotment Project which aims to automate the allotment of classes to available faculties and forming the time table.
Jupyter Notebook
1
star
30

nuclei-flutter-poc-qr-code-scanner

Dart
1
star
31

algorithms

An Algorithm must be seen to be believed
C++
1
star
32

torrential-lib-mobile-app

A demo flutter app which shows the usage of the torrential-lib library.
Dart
1
star
33

nuclei-assignment-2020-mobile

Freshers Assignment 2020 - Mobile Developer
Java
1
star
34

react-native-screen-resizer

Test your react native app across various device screen sizes and supercharge your application's responsiveness.
TypeScript
1
star
35

safe-rm-python

A safe "rm" script which is meant to be used in place of rm system command in linux . This script will safely delete your files and put them in the trash. This solves accidental removals.
Python
1
star
36

traffic-manager

Intel Higher Education challenge project which applies image processing for vehicles and uses the processed data to handle the traffic.
Python
1
star