Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python voice recognition

import speech_recognition as sr
import sys
import winsound

def speech_listen():
    r = sr.Recognizer()
    audio = ""
    with sr.Microphone() as source:
        print("")
        print("Listening...")
        audio = r.listen(source, phrase_time_limit=15)
    print("Processing...")
    try:
        u_said = r.recognize_google(audio, language='en-US')
        print(f"(●) {u_said}")
        print("Processing...")

        return u_said
    except:
        print("Awaiting command.")
        return 0
Source by github.com #
 
PREVIOUS NEXT
Tagged: #Python #voice #recognition
ADD COMMENT
Topic
Name
6+9 =