I was trying to use an audio output as Microphone()
When I list my microphones with
import speech_recognition as sr
for index, name in enumerate(sr.Microphone.list_microphone_names()):
print("Microphone with name \"{1}\" found for `Microphone(device_index={0})`".format(index, name))
the output has these devices: Microphone with name "Headphones ()" found for Microphone(device_index=17) and Microphone with name "Microphone (Realtek(R) Audio)" found for Microphone(device_index=15)
Expected behaviour
It would use my speakers to recognize audio/microphone(?)
I get an error
Traceback (most recent call last):
File "c:\Users\pedro\Desktop\python\speech-recognition\text-to-speech.py", line 6, in <module>
with mic:
File "C:\Users\pedro\AppData\Local\Programs\Python\Python38-32\lib\site-packages\speech_recognition\__init__.py", line 138, in __enter__
self.audio.open(
File "C:\Users\pedro\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyaudio.py", line 750, in open
stream = Stream(self, *args, **kwargs)
File "C:\Users\pedro\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyaudio.py", line 441, in __init__
self._stream = pa.open(**arguments)
OSError: [Errno -9998] Invalid number of channels
My system is Windows 10 x64.
My Python version is 3.8.5. (You can check this by running python -V.)
My Pip version is 20.3.3. (You can check this by running pip -V.)
My SpeechRecognition library version is 3.8.1.
My PyAudio library version is 0.2.11.
My microphones are: ['Microsoft Sound Mapper - Input', 'Microphone (Realtek(R) Audio)', 'Microphone (Voicemod Virtual Au', 'Microsoft Sound Mapper - Output', 'Alto-falantes (Realtek(R) Audio', 'Line (Voicemod Virtual Audio De', 'Primary Sound Capture Driver', 'Microphone (Realtek(R) Audio)', 'Microphone (Voicemod Virtual Audio Device (WDM))', 'Primary Sound Driver', 'Alto-falantes (Realtek(R) Audio)', 'Line (Voicemod Virtual Audio Device (WDM))', 'ASIO4ALL v2', 'Alto-falantes (Realtek(R) Audio)', 'Line (Voicemod Virtual Audio Device (WDM))', 'Microphone (Realtek(R) Audio)', 'Microphone (Voicemod Virtual Audio Device (WDM))', 'Headphones ()', 'Headset (@System32\\drivers\\bthhfenum.sys,#2;%1 Hands-Free AG Audio%0\r\n;(JBL TUNE205BT))', 'Headset (@System32\\drivers\\bthhfenum.sys,#2;%1 Hands-Free AG Audio%0\r\n;(JBL TUNE205BT))', 'Headphones ()', 'Speakers 1 (Realtek HD Audio output with SST)', 'Speakers 2 (Realtek HD Audio output with SST)', 'PC Speaker (Realtek HD Audio output with SST)', 'Stereo Mix (Realtek HD Audio Stereo input)', 'Microphone Array (Realtek HD Audio Mic input)', 'Headset (@System32\\drivers\\bthhfenum.sys,#2;%1 Hands-Free AG Audio%0\r\n;(JLab BT))', 'Headset (@System32\\drivers\\bthhfenum.sys,#2;%1 Hands-Free AG Audio%0\r\n;(JLab BT))', 'Microphone (VAD Wave)', 'Line Out (VAD Wave)']
My working microphones are: AttributeError: type object 'Microphone' has no attribute 'list_working_microphones' but all of them should be working
Steps to reproduce
Microphone()
When I list my microphones withthe output has these devices: Microphone with name "Headphones ()" found for
Microphone(device_index=17)
and Microphone with name "Microphone (Realtek(R) Audio)" found forMicrophone(device_index=15)
Expected behaviour
It would use my speakers to recognize audio/microphone(?)
I get an error
My system is Windows 10 x64.
My Python version is 3.8.5. (You can check this by running
python -V
.)My Pip version is 20.3.3. (You can check this by running
pip -V
.)My SpeechRecognition library version is 3.8.1.
My PyAudio library version is 0.2.11.
My microphones are:
['Microsoft Sound Mapper - Input', 'Microphone (Realtek(R) Audio)', 'Microphone (Voicemod Virtual Au', 'Microsoft Sound Mapper - Output', 'Alto-falantes (Realtek(R) Audio', 'Line (Voicemod Virtual Audio De', 'Primary Sound Capture Driver', 'Microphone (Realtek(R) Audio)', 'Microphone (Voicemod Virtual Audio Device (WDM))', 'Primary Sound Driver', 'Alto-falantes (Realtek(R) Audio)', 'Line (Voicemod Virtual Audio Device (WDM))', 'ASIO4ALL v2', 'Alto-falantes (Realtek(R) Audio)', 'Line (Voicemod Virtual Audio Device (WDM))', 'Microphone (Realtek(R) Audio)', 'Microphone (Voicemod Virtual Audio Device (WDM))', 'Headphones ()', 'Headset (@System32\\drivers\\bthhfenum.sys,#2;%1 Hands-Free AG Audio%0\r\n;(JBL TUNE205BT))', 'Headset (@System32\\drivers\\bthhfenum.sys,#2;%1 Hands-Free AG Audio%0\r\n;(JBL TUNE205BT))', 'Headphones ()', 'Speakers 1 (Realtek HD Audio output with SST)', 'Speakers 2 (Realtek HD Audio output with SST)', 'PC Speaker (Realtek HD Audio output with SST)', 'Stereo Mix (Realtek HD Audio Stereo input)', 'Microphone Array (Realtek HD Audio Mic input)', 'Headset (@System32\\drivers\\bthhfenum.sys,#2;%1 Hands-Free AG Audio%0\r\n;(JLab BT))', 'Headset (@System32\\drivers\\bthhfenum.sys,#2;%1 Hands-Free AG Audio%0\r\n;(JLab BT))', 'Microphone (VAD Wave)', 'Line Out (VAD Wave)']
My working microphones are:
AttributeError: type object 'Microphone' has no attribute 'list_working_microphones'
but all of them should be workingI have not installed PocketSphinx