def takecommand():
r = sr.Recognizer()
with sr.Microphone() as source:
print('listening...')
r.pause_threshold = 1
audio = r.listen(source, timeout=1, phrase_time_limit=5)
try:
print('Recognizing...')
query = r.recognize_google(audio, language='en-in')
print(f"user said: {query}")
except Exception as e:
speak("Say that again please...")
return "none"
return query
if name == "main":
takecommand()
speak('iam jarvis ')
teps to reproduce
(How do you make the issue happen? Does it happen every time you try it?)
(Make sure to go into as much detail as needed to reproduce the issue. Posting your code here can help us resolve the problem much faster!)
(If there are any files, like audio recordings, don't forget to include them.)
Expected behaviour
(What did you expect to happen?)
Actual behaviour
--C:\Users\Saikrishna\PycharmProjects\makerportfolios1\venv\Scripts\python.exe C:/Users/Saikrishna/PycharmProjects/makerportfolios1/main.py
listening...
Traceback (most recent call last):
File "C:\Users\Saikrishna\PycharmProjects\makerportfolios1\main.py", line 36, in
takecommand()
File "C:\Users\Saikrishna\PycharmProjects\makerportfolios1\main.py", line 22, in takecommand
audio = r.listen(source, timeout=1, phrase_time_limit=5)
File "C:\Users\Saikrishna\PycharmProjects\makerportfolios1\venv\lib\site-packages\speech_recognition__init__.py", line 618, in listen
raise WaitTimeoutError("listening timed out while waiting for phrase to start")
speech_recognition.WaitTimeoutError: listening timed out while waiting for phrase to start
Process finished with exit code 1
(What happened instead? How is it different from what you expected?)
(If the library threw an exception, paste the full stack trace here)
System information
(Delete all the statements that don't apply.)
My system is . (For example, "Ubuntu 16.04 LTS x64", "Windows 10 x64", or "macOS Sierra".)
My Python version is . (You can check this by running python -V.)
My Pip version is . (You can check this by running pip -V.)
My SpeechRecognition library version is . (You can check this by running python -c "import speech_recognition as sr;print(sr.__version__)".)
My PyAudio library version is / I don't have PyAudio installed. (You can check this by running python -c "import pyaudio as p;print(p.__version__)".)
My microphones are: (You can check this by running python -c "import speech_recognition as sr;print(sr.Microphone.list_microphone_names())".)
My working microphones are: (You can check this by running python -c "import speech_recognition as sr;print(sr.Microphone.list_working_microphones())".)
I installed PocketSphinx from. (For example, from the Debian repositories, from Homebrew, or from the source code.)
Simport pyttsx3 import speech_recognition as sr
engine = pyttsx3.init('sapi5') voices = engine.getProperty('voices')
print(voices[0].id)
engine.setProperty('voices', voices[0].id)
text to speech
def speak(audio): engine.say(audio) print(audio) engine.runAndWait()
def takecommand(): r = sr.Recognizer() with sr.Microphone() as source: print('listening...') r.pause_threshold = 1 audio = r.listen(source, timeout=1, phrase_time_limit=5)
if name == "main": takecommand()
speak('iam jarvis ')
teps to reproduce
Expected behaviour
(What did you expect to happen?)
Actual behaviour --C:\Users\Saikrishna\PycharmProjects\makerportfolios1\venv\Scripts\python.exe C:/Users/Saikrishna/PycharmProjects/makerportfolios1/main.py listening... Traceback (most recent call last): File "C:\Users\Saikrishna\PycharmProjects\makerportfolios1\main.py", line 36, in
takecommand()
File "C:\Users\Saikrishna\PycharmProjects\makerportfolios1\main.py", line 22, in takecommand
audio = r.listen(source, timeout=1, phrase_time_limit=5)
File "C:\Users\Saikrishna\PycharmProjects\makerportfolios1\venv\lib\site-packages\speech_recognition__init__.py", line 618, in listen
raise WaitTimeoutError("listening timed out while waiting for phrase to start")
speech_recognition.WaitTimeoutError: listening timed out while waiting for phrase to start
Process finished with exit code 1
(What happened instead? How is it different from what you expected?)
System information
(Delete all the statements that don't apply.)
My system is. (For example, "Ubuntu 16.04 LTS x64", "Windows 10 x64", or "macOS Sierra".)
My Python version is. (You can check this by running
python -V
.)My Pip version is. (You can check this by running
pip -V
.)My SpeechRecognition library version is. (You can check this by running
python -c "import speech_recognition as sr;print(sr.__version__)"
.)My PyAudio library version is / I don't have PyAudio installed. (You can check this by running
python -c "import pyaudio as p;print(p.__version__)"
.)My microphones are: (You can check this by running
python -c "import speech_recognition as sr;print(sr.Microphone.list_microphone_names())"
.)My working microphones are: (You can check this by running
python -c "import speech_recognition as sr;print(sr.Microphone.list_working_microphones())"
.)I installed PocketSphinx from. (For example, from the Debian repositories, from Homebrew, or from the source code.)