第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

用于桌面應(yīng)用程序的 Python 語音識別

用于桌面應(yīng)用程序的 Python 語音識別

Helenr 2023-08-08 17:42:01
我一直在嘗試使用庫在桌面上收聽音頻speech_recognition,但不知道如何實現(xiàn)它......例如:假設(shè)我們在后臺播放 YouTube 視頻,如何將語音(在桌面背景中)轉(zhuǎn)換為文本?
查看完整描述

1 回答

?
慕雪6442864

TA貢獻1812條經(jīng)驗 獲得超5個贊

嘗試這個


import speech_recognition as sr


r = sr.Recognizer()

m = sr.Microphone()


try:

    print("A moment of silence, please...")

    with m as source: r.adjust_for_ambient_noise(source)

    print("Set minimum energy threshold to {}".format(r.energy_threshold))

    while True:

        print("Say something!")

        with m as source: audio = r.listen(source)

        print("Got it! Now to recognize it...")

        try:

            value = r.recognize_google(audio)


            if str is bytes:

                print(u"You said {}".format(value).encode("utf-8"))

            else:

                print("You said {}".format(value))

        except sr.UnknownValueError:

            print("Oops! Didn't catch that")

        except sr.RequestError as e:

            print("Uh oh! Couldn't request results from Google Speech Recognition service; {0}".format(e))

except KeyboardInterrupt:

    pass  


查看完整回答
反對 回復(fù) 2023-08-08
  • 1 回答
  • 0 關(guān)注
  • 147 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號