语音识别无法识别内部麦克风。

huangapple go评论71阅读模式
英文:

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)

huangapple
  • 本文由 发表于 2023年6月19日 01:17:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/76501734.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定