1

对于一个小项目,我希望连接到缩放 API,这意味着:我想将音频、视频和聊天用作输入。并在我的程序中用这个输入做一些事情。到目前为止我所做的:我能够使用 python SpeechRecognition 库和虚拟电缆将音频连接到我的程序。我的下一步:不知何故使用聊天并用它和视频做一些事情。我用 python 编写我的程序,但我对其他方式持开放态度。谢谢!

import speech_recognition as sr
import keyboard
import os
import time


def takeCommand():
    r = sr.Recognizer()
    with sr.Microphone(device_index=2) as source:
        print("Listening...")
        r.pause_threshold = 1
        try:
            audio = r.listen(source, timeout=2)
        except sr.WaitTimeoutError as e:
            return "None"
    try:
        print("Recognizing...")
        query = r.recognize_google(audio, language='en-in')
        print(f"User said: {query}\n")

    except Exception as e:
        print(e)
        print("Unable to Recognizing your voice.")
        return "None"
    return query


if __name__ == '__main__':
    clear = lambda: os.system('cls')
    clear()

    while True:
        query = takeCommand().lower()
//dosomething with query
4

0 回答 0