Skip to content

Commit 307cdb5

Browse files
authored
Create text to speech
So, in this way, you can very easily make a text to speech conversion using Python. The file will be saved in the same folder where you are executing this python code (the current working folder). You can make this better in many ways like you can extract text from a pdf and then convert it to speech for reading out a pdf completely. You can also extract text from images and then do the same stuff.
1 parent 8682a38 commit 307cdb5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

text to speech

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
pip install gTTS
2+
#importing the gTTS library
3+
from gtts import gTTS
4+
#Asking the user for the required text
5+
mt = input("Enter the required text:\t")
6+
#Setting the output language
7+
language = ‘en’
8+
#Converting text to speech and choosing speed as fast
9+
voice = gTTS(text=mt, lang=language, slow=False)
10+
#Saving the speech as mp3 file
11+
voice.save(“conv.mp3”)

0 commit comments

Comments
 (0)