Open Gas999X opened 2 years ago
You can provide the desired interface with the device=
parameter (see https://python-sounddevice.readthedocs.io/en/0.4.3/api/streams.html#sounddevice.Stream).
with sd.RawStream(device=10, channels=2, dtype='int24', callback=callback): <-----------
When I substitute Device = 10 it gives an error.
File "C:\Users\karpo\AppData\Local\Programs\Python\Python39\Lib\site-packages\sounddevice.py", line 2741, in _check
raise PortAudioError(errormsg, err)
sounddevice.PortAudioError: Error opening RawStream: Invalid number of channels [PaErrorCode -9998]
I don't know formats or how many channels your respective input and output interfaces (you will have to provide both names or IDs) support. But https://github.com/spatialaudio/python-sounddevice/blob/0.4.3/examples/wire.py seems to do everything you need. Try to find a working configuration with that implementation (sd.query_devices()
should help) and then simplify / adapt the code for your purposes.
sd.default.samplerate = None sd.default.device = None, 7
sd.default.device = input(None = default) , output
I found the answer here
https://python-sounddevice.readthedocs.io/en/0.3.11/#sounddevice.default
Just to clarify: you can do both things mentioned above, both should work:
device=mydevice
or device=(myinputdevice, myoutputdevice)
in the stream constructorsd.default.device = mydevice
or sd.default.device = myinputdevice, myoutputdevice
before you create your stream (either directly or via some helper function like playrec()
)I either case you can use None
to get the default device.
You can specify your devices either by their numeric ID or by (space-separated) substring(s).
Greetings, there is a code on the link,
and it suits me completely, I just didn't understand how to enter my equipment IDs, I want to output the signal from the microphone to a virtual cable. Id = 3