Skip to content

Commit 716b158

Browse files
Merge pull request #2525 from SomdattaNag/add-text-to-speech
Added text-to-speech functionality to generate voice from python code for Issue #2511.
2 parents cb976b0 + 203a9b9 commit 716b158

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Diff for: Python Voice Generator.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#install and import google text-to-speech library gtts
2+
from gtts import gTTS
3+
import os
4+
#provide user input text
5+
text=input('enter the text: ')
6+
#covert text into voice
7+
voice=gTTS(text=text, lang='en')
8+
#save the generated voice
9+
voice.save('output.mp3')
10+
#play the file in windows
11+
os.system('start output.mp3')

0 commit comments

Comments
 (0)