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