There are several APIs available to convert text to speech in python. One of such APIs is the Google Text to Speech API commonly known as the gTTS API. gTTS is a very easy to use tool which converts the text entered, into audio which can be saved as a mp3 file.
The gTTS API supports several languages including English, Hindi, Tamil, French, German and many more. The speech can be delivered in any one of the two available audio speeds, fast or slow. However, as of the latest update, it is not possible to change the voice of the generated audio.
To install the gTTS API, open terminal and write
pip install gTTS
This works for any platform.
Now we are all set to write a sample program that converts text to speech.
The output of the above program should be a voice saying, 'Welcome to geeksforgeeks!'
This article is contributed by Akhil Goel. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Python: Convert Speech to text and text to Speech
- Speech Recognition in Python using Google Speech API
- Convert Text to Speech in Python using win32com.client
- Python | Convert image to text and then to speech
- Convert PDF File Text to Audio Speech using Python
- Text-To-Speech changing voice in Python
- Python Text To Speech | pyttsx module
- Python | Text to Speech by using pyttsx3
- Text to speech GUI convertor using Tkinter in Python
- Speech To Text using IBM Watson Studio
- Convert Text and Text File to PDF using Python
- Part of Speech Tagging with Stop words using NLTK in python
- Python | Part of Speech Tagging using TextBlob
- Python | Speech recognition on large audio files
- Python - Get Today's Current Day using Speech Recognition
- Speech Recognition in Hindi using Python
- NLP | Part of Speech - Default Tagging
- NLP | Part of speech tagged - word corpus
- Restart your Computer with Speech Recognition
- Introduction to Speech Separation Based On Fast ICA