Hello Everyone , i am writing this piece of code to convert the text to audio.
Below are module needs to be installed .
1.gtts
2.pygame
Note : For Mac , please download 1.9.2 incase you are facing any issue with the
latest package.
And below code will ask for text input from user and it converts text to audio (chatBot.wav) file and
save it to local directory .
Once file is saved it will simply play the audio file.
Below are module needs to be installed .
1.gtts
2.pygame
Note : For Mac , please download 1.9.2 incase you are facing any issue with the
latest package.
And below code will ask for text input from user and it converts text to audio (chatBot.wav) file and
save it to local directory .
Once file is saved it will simply play the audio file.
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
import speech_recognition as sr | |
r=sr.Recognizer() | |
r.pause_threshold=0.7 | |
r.energy_threshold=400 | |
while(1): | |
with sr.Microphone () as source: | |
audio=r.listen(source) | |
message=str(audio) | |
try: | |
print(r.recognize_google(audio)) | |
except sr.UnknownValueError: | |
print("We could not understand audio please speak again") |
I needed to thank you for this incredible read!! I unquestionably adored each and every piece of it. I have you bookmarked your site to look at the new stuff you post. Places you need to visit in 2019. ... Upgrade your travel photos with these lightweight cameras that pack a punch ... Enjoy the world's best places to travel with Things to do.
ReplyDelete