Text to speech in Python

0

In this article, you will see how we can use python to convert text into speech in python. you will see how we can do the conversion of text into audio.

This method is very helpful in the conversion of textbooks into audiobooks with the help of python programming language.

Check: 100+ Python Projects with Source Code

How do I convert text into speech in Python

we will be using the gtts library to do the conversion of text into speech. The gtts library in python is very helpful in the conversion of text into audio.

Install gtts library in Python


pip install gtts

Related Articles:

Learn the os Module in Python

Python code to covert text into audio


from gtts import gTTS 
import os
file = open("abc.txt", "r").read()

speech = gTTS(text=file, lang='en', slow=False)
speech.save("voice.mp3")
os.system("voice.mp3")

Related Python Projects:

Summary and Conclusion:

You have seen how we can use the gtts module in python to do the conversion of text into speech in python. if you have any questions, please leave them in the comment section.

Post a Comment

0Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.
Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !