What is the benefit of Text to speech conversion?

There are numerous benefits of this technique if you have large text data and you don’t want to read them all, even there are many people who would prefer listening to podcasts and audiobooks as their way of consuming information, especially while they are traveling.

What is gTTS?

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 an mp3 /wav file.

Features

  • Customizable speech-specific sentence tokenizer that allows for unlimited lengths of text to be read, all while keeping proper intonation, abbreviations, decimals and more;
  • Customizable text pre-processors which can, for example, provide pronunciation corrections;
  • Automatic retrieval of supported languages.

Installation

To install gTTS library run below code, this command automatically downloads and installs the library

pip install gTTS
pip install os

Importing the necessary libraries

in this step, we will import important libraries that we will be using throughout this tutorial.

import os
from gtts import gTTS

#text #audio #data-science #nlp #data-analysis

Text to Speech Conversion with Python
1.55 GEEK