Reputation: 29
I want to make a Python program where microphone audio input is received.
I already tried pyaudio but I can't understand how it works.
Upvotes: 1
Views: 1112
Reputation: 575
There is this module called gTTS
that you can use instead.
The
get_audio
function will be able to detect a users voice, translate the audio to text and return it to us. It will even wait until the user is speaking to start translating/recording the audio
Here's a complete example on Getting user input
using the get_audio
function.
def get_audio():
r = sr.Recognizer()
with sr.Microphone() as source:
audio = r.listen(source)
said = ""
try:
said = r.recognize_google(audio)
print(said)
except Exception as e:
print("Exception: " + str(e))
return said
Upvotes: 3