Answer the question
In order to leave comments, you need to log in
Why is the python library not responding to speech?
I watched a video on creating a speech recognizer, a person did it on a poppy, I have win10, there are no errors, everything is installed, here is the code
import speech_recognition as sr
import os
import sys
import webbrowser
import pyttsx3
def talk(words):
engine = pyttsx3.init()
engine.say(words)
engine.runAndWait()
talk("привет, я твой личный помощник, умею открывать некоторые нужные программы")
def command():
r = sr.Recognizer()
with sr.Microphone() as source:
talk('что открыть?')
r.pause_threshold = 1
r.adjust_for_ambient_noise(source, duration=1)
audio = r.listen(source)
try:
mission = r.recognize_google(audio).lower()
print('вы сказали'+ mission)
except sr.UnknownValueError:
talk('не распознано')
mission = command()
return mission
def makeMission(mission):
if 'привет' in mission:
talk('выполняю')
url = 'http://egorkorsakov.ru/'
webbrowser.open(url)
elif 'stop' in mission:
talk('cамоуничтожение запущено')
sys.exit()
while True:
makeMission(command())
Answer the question
In order to leave comments, you need to log in
Well, everything works for me through the phone headphones connected to the laptop :)
1) To check access to the microphone, you need to:
1. Open the parameters.
2. Open privacy
3. Open microphone.
4. Check microphone availability:
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question