Advertisement
Anonimus2009

Untitled

May 29th, 2021
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. import speech_recognition as sr
  2.  
  3. r = sr.Recognizer()
  4. with sr.Microphone(device_index=2) as source:
  5. print("Скажите что-нибудь ...")
  6. audio = r.listen(source)
  7.  
  8. query = r.recognize_google(audio, Language="ru-RU")
  9. print("Вы сказали: " + query.lower())
  10.  
  11. ошибка:
  12. Traceback (most recent call last):
  13. File "C:\Users\User\Desktop\jarvis.py", line 4, in <module>
  14. with sr.Microphone(device_index=3) as source:
  15. File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\speech_recognition\__init__.py", line 138, in __enter__
  16. self.audio.open(
  17. File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\pyaudio.py", line 750, in open
  18. stream = Stream(self, *args, **kwargs)
  19. File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\pyaudio.py", line 441, in __init__
  20. self._stream = pa.open(**arguments)
  21. OSError: [Errno -9998] Invalid number of channels
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement