Python的语音识别很慢

问题描述 投票:1回答:1

我目前正在开发一个智能助手程序(基本上是刚听用户说的话,并基于该做一些事的代码)。这是工作的罚款,直到今天,当我切换到我的笔记本电脑。该程序不会打印出任何错误,但它也不会打印出我说的话。我使用Python Speech Recognition库版本3.8.1。有谁知道这个库替代的?如果是,请尽量说明我会用它“对飞”(没有先记录文件,然后将其发送到服务器,更像是实时语音)。

编辑:我忘了说,它在后,我使用Python 3。

编辑:下面的代码:

#!/usr/bin/env python3

import speech_recognition as sr


global x


def speech():

    try:
        with sr.Microphone() as source:
            global x
            r = sr.Recognizer()
            audio = r.listen(source)
            x = r.recognize_google(audio)
    except sr.UnknownValueError:
        print("No clue what you said, listening again... \n")
        speech()


if __name__ == '__main__':
    print('Listening and printing what I heard: \n')
    speech()
    print(x)
python python-3.x speech-recognition
1个回答
1
投票

我发现这个问题是在笔记本电脑的麦克风。语音识别能正常工作后,我在我的蓝雪球堵塞。我强迫程序通过进入pavucontrol和记录选项卡下选择蓝雪球使用蓝雪球。

© www.soinside.com 2019 - 2024. All rights reserved.