We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
gtts
1 parent 1289aeb commit 12cebd1Copy full SHA for 12cebd1
_gtts.py
@@ -0,0 +1,15 @@
1
+from playsound import playsound
2
+from io import BytesIO
3
+from gtts import gTTS
4
+import tempfile
5
+
6
+def tts_file(text, lang='en', slow=False):
7
+ with tempfile.TemporaryFile() as temp_handler:
8
+ engine = gTTS(text=text, lang=lang, slow=slow)
9
+ engine.save(temp_handler.name)
10
+ playsound(temp_handler.name)
11
12
+def tts_direct(text, lang='en', slow=False):
13
+ io = BytesIO()
14
15
+ engine.write_to_fp(io)
0 commit comments