Created
March 19, 2020 11:01
-
-
Save asadamatic/6ec460a366094517bcd3263c45a65cde to your computer and use it in GitHub Desktop.
A python program that reads text from a file and converts it to audio, saves it and plays it using default audio player.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gtts import gTTS | |
import os | |
with open('message.txt') as file: | |
message = file.read() | |
output = gTTS(text = message, lang = 'hi', slow = False) | |
output.save('messageFromFile.mp3') | |
os.system('start messageFromFile.mp3') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment