python SpeechRognizer

发布于 2025-02-04 11:53:03 字数 568 浏览 2 评论 0原文

我目前正在研究自己的语音助手,但我经常有一个问题,即回答/认识到我什么都没说的需要很长时间。 我已经尝试使用:

listener.energy_threshold = 120
with sr.Microphone() as source:
    listener.adjust_for_ambient_noise(source,duration=1)

但似乎没有帮助。

我的侦听器功能:

def take_command():
    try:
        with sr.Microphone() as source:
            voice = listener.listen(source)
            command = listener.recognize_google(voice, language="de")
            command = command.lower()
    except:
        print("failed")
    return command

通常,助手需要一分钟或更多时间来回答。

I'm currently working on my own voice assistant, but I often times have the problem that it's taking very long to answer/recognize that I'm not sayin anything.
I already tried using:

listener.energy_threshold = 120
with sr.Microphone() as source:
    listener.adjust_for_ambient_noise(source,duration=1)

but it didn't seem to help.

My listener function:

def take_command():
    try:
        with sr.Microphone() as source:
            voice = listener.listen(source)
            command = listener.recognize_google(voice, language="de")
            command = command.lower()
    except:
        print("failed")
    return command

Oftentimes the assistant takes a minute or more to answer.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文