英文:
speech recognition not recognising on internal mic
问题
我的个人助手语音识别在使用耳机时正常工作,但在没有耳机时使用内置麦克风时无法识别声音。
代码:
with sr.Microphone() as source:
print("Listening...")
speak("Listening...")
r.pause_threshold = 1
audio = r.listen(source)
操作系统:Ventura 13.4(M1)
英文:
I was making my personal assistant speech_recognition is working properly with headphones but without headphones on internal mic it is not recognising the voice.
Code:
with sr.Microphone() as source:
print("Listening...")
speak("Listening...")
r.pause_threshold = 1
audio = r.listen(source)
OS: Ventura 13.4 (M1)
答案1
得分: 1
感谢KathyReid在评论中帮助我。
实际上,这很容易,只需将采样率从96KHz更改为48KHz即可。
以下是代码编辑部分:
with sr.Microphone(sample_rate=48000) as source:
print("Listening...")
speak("Listening...")
r.pause_threshold = 1
audio = r.listen(source)
英文:
Thanks to KathyReid for helping me in comments.
Actually it was really easy it worked by just change sample rate from 96KHz to 48KHz
Here is a code edit:
with sr.Microphone(sample_rate=48000) as source:
print("Listening...")
speak("Listening...")
r.pause_threshold = 1
audio = r.listen(source)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论