Posts

Showing posts with the label gTTS API

Text to Speech Conversion in Python through gtts module

# pip install gTTS to install the required module # gTTS is Google Text to Speech API from gtts import gTTS import os mytext = "hi, this is abdur rehmaan." mylanguage = "en" obj = gTTS ( text = mytext , lang = mylanguage , slow = False ) obj . save ( "hi.mp3" ) # saves the text as mp3 file os . system ( "hi.mp3" ) # play the converted mp3 file