开放课程的语音识别

时间:2018-06-02 11:53:44

标签: python python-3.x speech-recognition speech

import speech_recognition as sr
import os

# obtain audio from the microphone
r = sr.Recognizer()

def get_audio():
    global RealAudio
    with sr.Microphone() as source:
        print("Say something!")
        audio = r.listen(source)
    try:
        RealAudio = r.recognize_google(audio)
        print(RealAudio)
        commands_audio()
    except sr.UnknownValueError:
        print("Impossibole to understand.\n")
        get_audio()

def start_function():
    global Discord
    try:
        if Discord == 'False':
            os.system('cd D:\\Program\\Steam\Steam.exe')

if 'open Steam' in RealAudio:
    Discord = False
    start_function()
    get_audio()  

我刚刚开始使用我的语音程序。我总是收到错误消息'无法找到特定目录'。我想要它打开Steam.exe程序。

0 个答案:

没有答案