Skip to content

Commit e4d395e

Browse files
Merge pull request #2520 from ayushh0406/patch-1
text _to_voice.py
2 parents cd813a5 + 378a018 commit e4d395e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Diff for: voice.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from gtts import gTTS
2+
import os
3+
4+
# Define the text you want to convert to speech
5+
text = "Hello! This is a sample text to convert to speech."
6+
7+
# Create a gTTS object
8+
tts = gTTS(text=text, lang='en')
9+
10+
# Save the audio file
11+
tts.save("output.mp3")
12+
13+
# Play the audio file
14+
os.system("start output.mp3")

0 commit comments

Comments
 (0)