Skip to content

gfda/text-to-speech

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Text-to-speech

TTS

License: MIT

A simple text-to-speech program using:

  • Python3 GUI (tkinter);
  • Google Text-to-Speech Python lib(gTTS);

Setup

Installing

Install Google Text-to-Speech lib

user@linux:~$ pip install gTTS

Imports

Google Text-to-Speech

from gtts import gTTS

To use operating system funcionalities, import Python OS module

import os

Tkinter Python GUI

from tkinter import *

To show errors, attention and other alert messages

from tkinter import messagebox

For Mac OS users, some buttons and icons does not work properly. Please, use ttk submodule.

from tkinter import ttk

Let's Speak

Before running the program, you need to choose the correct player based on your operating system.

(afplay is a Mac OS command.)

Choosing the player

  • For Arch Linux based (Manjaro...)
user@linux:~$ sudo pacman -S mpg123
  • For Debian Linux based (Ubuntu...)
user@linux:~$ sudo apt-get update
user@linux:~$ sudo apt-get install mpg123
  • For Redhat Linux based (Fedora, SUSE...)
user@linux:~$ yum install mpg123

After successful installation, you can test it.

user@linux:~$ mpg123 <some_audio_file>.mp3

NOTE

It's necessary to change afplay to correct mp3 player at /source/TextToSpeech.py

#The argument & indicates afplay to run in the background as a job.
os.system("afplay sound/output.mp3 &")

License

This project is licensed under the MIT License.

Author

Gustavo Dias A.

About

A simple text-to-speech program using Python3 GUI and Google Text-to-Speech.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages