Home Python Speech Recognition no sound from audio interface
Reply: 0

Python Speech Recognition no sound from audio interface

Marcel
1#
Marcel Published in 2018-02-10 13:42:41Z

I've got a problem with Python (3.5.3) and using an audio interface. The following code works perfectly with the Built-in microphone

import speech_recognition as sr

for index, name in enumerate(sr.Microphone.list_microphone_names()):
    print("Microphone with name \"{1}\" found for `Microphone(device_index={0})`".format(index, name))
r = sr.Recognizer()
with sr.Microphone(device_index=4) as source:
    audio = r.record(source, duration = 5)
with open("microphone-results.wav", "wb") as f:
    f.write(audio.get_wav_data())    

but as soon as I change it to

with sr.Microphone(device_index=4) as source:

there is just 5 seconds of silence. Device 4 is definitely my interface. I've even tried it with another one to make sure its not the interface that's the problem, but with the same result. The microphone I'm using is definitely working, I can record audio in Audacity without a problem.

Hope someone can help,

Thank you!

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.311163 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO