From 307cdb53993a5fc86eb56cc7fd2c5e709c5958a0 Mon Sep 17 00:00:00 2001 From: akhilesh147 <73053922+akhilesh147@users.noreply.github.com> Date: Mon, 19 Oct 2020 07:23:12 +0530 Subject: [PATCH] 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. --- text to speech | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 text to speech diff --git a/text to speech b/text to speech new file mode 100644 index 00000000000..a26af2d64f8 --- /dev/null +++ b/text to speech @@ -0,0 +1,11 @@ +pip install gTTS +#importing the gTTS library +from gtts import gTTS +#Asking the user for the required text +mt = input("Enter the required text:\t") +#Setting the output language +language = ‘en’ +#Converting text to speech and choosing speed as fast +voice = gTTS(text=mt, lang=language, slow=False) +#Saving the speech as mp3 file +voice.save(“conv.mp3”)