From 94a646e2dcbb18e1b3b3ba830d4112179f6f8ea5 Mon Sep 17 00:00:00 2001 From: abhinab-choudhury Date: Fri, 20 Oct 2023 17:43:56 +0530 Subject: [PATCH] Text to Speech.py Added This Program is capable of converting text in various language to audio.It used gTTS library. --- Text-To-Speech.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Text-To-Speech.py diff --git a/Text-To-Speech.py b/Text-To-Speech.py new file mode 100644 index 00000000..decb831d --- /dev/null +++ b/Text-To-Speech.py @@ -0,0 +1,19 @@ +from gtts import gTTS +""" + Install gTTS : pip3 install gTTS + +""" + +# Initialize the gTTS object +file_path = str(input("Enter the File name with Extension : ")) +with open(file_path) as f: + file_text = f.read() + + +lg = input("Enter Language code : ") +tts = gTTS(file_text, lang=lg) + +# Save the audio file +tts.save(file_path.split(".")[0] + ".mp3") + +