ROBOT VOICE
'''
Pyaudio − It can be installed by using pip install Pyaudio command.
SpeechRecognition − This package can be installed by using pip install SpeechRecognition.
Google-Speech-API − It can be installed by using the command pip install google-api-python-client.
'''
import speechrecognition as sr
from gtts import gTTS
import os
voice=" "
while True:
r=sr.Recognizer()
with sr.Microphone() as source:
try:
audio=r.listen(source)
text=r.recognize_google(audio)
print(text)
if text=="stop":
break
text=r.recognize_google(audio)
voice=voice + str(text)
except:
print("say --- something")
hr=gTTS(text=voice,Lang='en',slow=False)
hr.save("1.wav")
Comments
Post a Comment