I am trying to record device audio using Python. It seems that pyaudio only works with external devices. It seems that sounddevice as sd is the answer as it lets us choose default device. The code is
sd.query_devices()
to get the list of available devices and
sd.default.device
to chose from them.
I am trying the codes from https://python-sounddevice.readthedocs.io. All of them works with external devices in spyder. When I write
sd.default.device = 5
it gives errors. When I try sd.default.device = 5 which is Speakers (Realtek HD Audio output), Windows WDM-KS (0 in, 2 out) it gives the error that it is not an input device. I understand the error, But I dont know even when I give an input device like 0 Microsoft Sound Mapper - Input, MME (2 in, 0 out) it is not working to record the device audio.