You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
how to get channel name of audio device with ASIO driver? #348
hi, could anyone tell me how to get channel name of audio device with ASIO driver? or is it possible to do it with sounddevice?
for example, if we use:
sounddevice.query_devices()
to get device list, we can obtain all available devices , including those with ASIO driver:
69 Cube 6Nano, ASIO (20 in, 20 out)
we can see the above device contains 20 input channels and 20 output channels, we can use these channels with the corresponding channels index from 1 to 20, for example:
then i replace the intial libportaudio64bit.dll locates at C:\Program Files\Python\Python38\Lib\site-packages_sounddevice_data\portaudio-binaries
then i add a method to the sounddevice.py, reference to rholl:
defasio_get_input_channel_name(device, channel):
"""Retrieve the name of the specified output channel. Parameters ---------- device : int Device ID. (aka The global index of the PortAudio device.) channel : int Channel number from 0 to max_*_channels-1. Returns ------- The channel's name : str """channel_name=_ffi.new('char*[1]')
_check(_lib.PaAsio_GetInputChannelName(device, channel, channel_name))
return_ffi.string(channel_name[0]).decode()
finally I write a demo code:
importsounddeviceassd# from sounddevice_GitHub import sounddevice as sdprint(sd.query_devices())
print(sd.asio_get_input_channel_name(68, 0))
print(sd.asio_get_input_channel_name(68, 1))
print(sd.asio_get_input_channel_name(69, 0))
print(sd.asio_get_input_channel_name(69, 1))
sd.query_devices() is ok, but sd.asio_get_input_channel_name() is wrong, the error feedback is :
Traceback (most recent call last):
File "D:/working/Python/2 library/Sounddevice/test/demo_channelname_1.py", line 5, in <module>
print(sd.asio_get_input_channel_name(68, 0))
File "D:\working\Python\2 library\Sounddevice\sounddevice_GitHub\sounddevice.py", line 2341, in asio_get_input_channel_name
_check(_lib.PaAsio_GetInputChannelName(device, channel, channel_name))
AttributeError: cffi library 'C:\Program Files\Python\Python38\lib\site-packages\_sounddevice_data\portaudio-binaries\libportaudio64bit.dll' has no function, constant or global variable named 'PaAsio_GetInputChannelName'
so how to make the method 'PaAsio_GetInputChannelName' callable in python? thanks.
Activity
mgeier commentedon Jul 6, 2021
This is currently not implemented.
See #4 (comment) and #85 for a possible implementation.
bactone commentedon Jul 9, 2021
@mgeier hi, i have try to rebuild the .dll lib, including the following method:
then i replace the intial libportaudio64bit.dll locates at C:\Program Files\Python\Python38\Lib\site-packages_sounddevice_data\portaudio-binaries
then i add a method to the sounddevice.py, reference to rholl:
finally I write a demo code:
sd.query_devices() is ok, but sd.asio_get_input_channel_name() is wrong, the error feedback is :
so how to make the method 'PaAsio_GetInputChannelName' callable in python? thanks.
mgeier commentedon Jul 9, 2021
You'll have to copy the missing function definitions from the PortAudio header files to sounddevice_build.py.
TheArpeggiator commentedon Jul 25, 2023
Any luck with your script @bactone? I'm also highly interested in being able to list ASIO channel names using PySounddevice.