Thank you so much. I was facing this ERROR: PyAudio-0.2.11-cp38-cp38-win_amd64.whl is not a supported wheel on this platform. It turned out I have python 3.7.4 and I was installing the wrong version of pyaudio. The correct version for me: PyAudio-0.2.11-cp37-cp37m-win_amd64.whl
I have error in the following line: with sr.Microphone() as source: Could not find PyAudio; check installation I have installed pyaudio in every possible way and it still won't run, is it because of the environment, I have python 3.9 and 3.11 in vs. Has anyone encountered the same problem?
Hi bro! Excellent content! I get this 2 errors: Traceback (most recent call last): File "C:\Users\mgreco\PycharmProjects\VoiceToTxt\test.py", line 13, in listen recognizer.adjust_for_ambient_noise(source) File "C:\Users\mgreco\PycharmProjects\VoiceToTxt\venv\lib\site-packages\speech_recognition\__init__.py", line 383, in adjust_for_ambient_noise assert source.stream is not None, "Audio source must be entered before adjusting, see documentation for ``AudioSource``; are you using ``source`` outside of a ``with`` statement?" AssertionError: Audio source must be entered before adjusting, see documentation for ``AudioSource``; are you using ``source`` outside of a ``with`` statement? During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\mgreco\PycharmProjects\VoiceToTxt\test.py", line 27, in listen(recognizer, micro) File "C:\Users\mgreco\PycharmProjects\VoiceToTxt\test.py", line 11, in listen with micro as source: File "C:\Users\mgreco\PycharmProjects\VoiceToTxt\venv\lib\site-packages\speech_recognition\__init__.py", line 189, in __exit__ self.stream.close() AttributeError: 'NoneType' object has no attribute 'close' Do you know what could be causing this? PyAudio and speechrecognition installed correctly. Collecting pyaudio Using cached PyAudio-0.2.13-cp310-cp310-win_amd64.whl (164 kB) Installing collected packages: pyaudio Successfully installed pyaudio-0.2.13 Installing collected packages: speechrecognition Successfully installed speechrecognition-3.10.0
Have you tried commenting out the adjust_for_ambient_noise to see if that fixes the problem? I'll try and look up the documentation to see if the library has changed the method names too.
Really impressed!the way you explained everything in a detailed manner
Thank you for the positive feedback.
Thank you so much. I was facing this ERROR: PyAudio-0.2.11-cp38-cp38-win_amd64.whl is not a supported wheel on this platform. It turned out I have python 3.7.4 and I was installing the wrong version of pyaudio. The correct version for me: PyAudio-0.2.11-cp37-cp37m-win_amd64.whl
This was a great help. Thank you so much. I was really stuck while doing a project with this.
I'm so glad to hear that!
I have error in the following line: with sr.Microphone() as source:
Could not find PyAudio; check installation
I have installed pyaudio in every possible way and it still won't run, is it because of the environment, I have python 3.9 and 3.11 in vs.
Has anyone encountered the same problem?
I'm assuming you tried this video all the way through and it still didn't work?
@@BrandonJacobson didn´t work. I have 3 versions of python installed. This is bad?
@@McKane_CL No, not necessarily. My video explains using the .whl file for Windows 64-bit, did you install the right .whl file?
@@BrandonJacobson yes.
Hi bro! Excellent content! I get this 2 errors:
Traceback (most recent call last):
File "C:\Users\mgreco\PycharmProjects\VoiceToTxt\test.py", line 13, in listen
recognizer.adjust_for_ambient_noise(source)
File "C:\Users\mgreco\PycharmProjects\VoiceToTxt\venv\lib\site-packages\speech_recognition\__init__.py", line 383, in adjust_for_ambient_noise
assert source.stream is not None, "Audio source must be entered before adjusting, see documentation for ``AudioSource``; are you using ``source`` outside of a ``with`` statement?"
AssertionError: Audio source must be entered before adjusting, see documentation for ``AudioSource``; are you using ``source`` outside of a ``with`` statement?
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\mgreco\PycharmProjects\VoiceToTxt\test.py", line 27, in
listen(recognizer, micro)
File "C:\Users\mgreco\PycharmProjects\VoiceToTxt\test.py", line 11, in listen
with micro as source:
File "C:\Users\mgreco\PycharmProjects\VoiceToTxt\venv\lib\site-packages\speech_recognition\__init__.py", line 189, in __exit__
self.stream.close()
AttributeError: 'NoneType' object has no attribute 'close'
Do you know what could be causing this? PyAudio and speechrecognition installed correctly.
Collecting pyaudio
Using cached PyAudio-0.2.13-cp310-cp310-win_amd64.whl (164 kB)
Installing collected packages: pyaudio
Successfully installed pyaudio-0.2.13
Installing collected packages: speechrecognition
Successfully installed speechrecognition-3.10.0
My code:
from typing import Any, List, Tuple
import speech_recognition as sr
recognizer = sr.Recognizer()
micro = sr.Microphone()
def listen(recognizer, micro):
while True:
try:
with micro as source:
print('Listening...')
recognizer.adjust_for_ambient_noise(source)
recognizer.dynamic_energy_threshold = 3000
audio = recognizer.listen(source, timeout=5.0)
response = recognizer.recognize_google(audio)
print(response)
return response
except sr.WaitTimeoutError:
pass
except sr.UnknownValueError:
pass
except sr.RequestError:
print('Network error.')
while True:
listen(recognizer, micro)
Have you tried commenting out the adjust_for_ambient_noise to see if that fixes the problem? I'll try and look up the documentation to see if the library has changed the method names too.
thank you sir , it helped me .
thanx a lot....
thank you
pls i need ur help