-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
selecting multiple devices as in and/or out (Windows) #29
Comments
PortAudio's "streams" can at most have one input device and one output device. AFAIK, PortAudio provides no means for combining multiple devices into a single new one. You can try to use one stream per device (which may or may not work depending on the host API in use), but it will be hard (or impossible?) to start and stop them at the exact same time. I don't know much about Windows and even less about Cygwin. I assume the bundled DLL doesn't work there? What about the other host APIs for Windows? Which of them are available? Why does it work with Anaconda? Are you using Anaconda within Cygwin? Is this even possible? |
"such many questions (sorry I couldn't resist) Thanks for the information about the impossibility for portaudio to aggregate devices. This rules out one option, and possibly this issue. I don't know the answer to essentially any of these questions, but I guess conda works because it's using the asio driver that resides natively in win, while cygwin is somewhat abstracted/separated from the native win layer. Not sure if this makes sense, but it's my feeling. Thanks for your time and sorry for the "silly" question. |
I don't think that's a silly question. All those operating systems and audio backends are really confusing ... If you find anything new, please share it here! Just out of curiosity, could you please share the device list which you get when running on Cygwin? |
(sorry I was traveling and I didn't have the madiface with me...) In [3]: sd.query_devices()
Out[3]:
0 Microsoft Sound Mapper - Input, MME (2 in, 0 out)
> 1 Microphone Array (IDT High Defi, MME (2 in, 0 out)
2 MADI (25-32) (RME MADIface USB), MME (2 in, 0 out)
3 MADI (33-40) (RME MADIface USB), MME (2 in, 0 out)
4 MADI (57-64) (RME MADIface USB), MME (2 in, 0 out)
5 Jack Mic (IDT High Definition A, MME (2 in, 0 out)
6 MADI (17-24) (RME MADIface USB), MME (2 in, 0 out)
7 MADI (49-56) (RME MADIface USB), MME (2 in, 0 out)
8 MADI (1-8) (RME MADIface USB), MME (2 in, 0 out)
9 MADI (9-16) (RME MADIface USB), MME (2 in, 0 out)
10 Rec. Playback (IDT High Definit, MME (2 in, 0 out)
11 Dock Mic (IDT High Definition A, MME (2 in, 0 out)
12 MADI (41-48) (RME MADIface USB), MME (2 in, 0 out)
13 Microsoft Sound Mapper - Output, MME (0 in, 2 out)
< 14 Speakers / Headphones (IDT High, MME (0 in, 2 out)
15 Communications Headphones (IDT , MME (0 in, 2 out)
16 MADI (49-56) (RME MADIface USB), MME (0 in, 2 out)
17 MADI (17-24) (RME MADIface USB), MME (0 in, 2 out)
18 MADI (41-48) (RME MADIface USB), MME (0 in, 2 out)
19 MADI (1-8) (RME MADIface USB), MME (0 in, 2 out)
20 MADI (25-32) (RME MADIface USB), MME (0 in, 2 out)
21 MADI (57-64) (RME MADIface USB), MME (0 in, 2 out)
22 MADI (33-40) (RME MADIface USB), MME (0 in, 2 out)
23 MADI (9-16) (RME MADIface USB), MME (0 in, 2 out) while with asio support I can use the interface as one interface and not as different stereo interfaces... |
ufff... my mistake, I pressed "close and comment" instead of comment... I'd better get some rest today. |
In Windows MME there seems to be a setting None of this is currently implemented in the |
Hello, I am exactly trying to do the same. I use RME fireface 802 sound card and Windows but would like to communicate using sounddevice or similar in Python. I need to simultaneously output to two different devices and record from another one. Did you find any solution for this problem or have any recommendation for me? Thanks! |
@marinasaizalia Did you have a look at the MME stuff I mentioned above? On Linux/ALSA you can combine devices using a configuration file ( |
@marinasaizalia With "two different devices" do you mean your RME fireface 802 plus another sound card? In the latter case, you can just use ASIO and the sound card will be shown as one single device. What does |
@mgeier thanks for all these! With "two different devices" I mean just the RME fireface soundcard that has connected different inputs and outputs. I have to play in two (through two different set of earphones) and record simultaneously from a microphone. I call them device because when I do sd.play() I select the earphones I want to play through as device=its ID number. So I guess I can use and ASIO driver. I may be missing this. I am not in the same computer now so I cant show you the screenshot of sd.query_devices() but it shows a list of the inputs/outputs that are connected to the RME fireface soundcard plus the speakers in the computer. I can see different audio APIs: MME, WASAPI, WDM/KS and DirectSound but no ASIO. So when I tried to use sd.AsioSettings(channel_selectors=...) (https://python-sounddevice.readthedocs.io/en/0.3.7/) to create specific input/output settings I got an error which said "error opening output stream: incompatible host API stream info" I only installed the driver for the RME soundcard. Do I also need an ASIO driver? Thanks for everything (as you can see I am very new in all these!) |
@mgeier hello again! I went to the computer and got the sd.query_devices() so I copy it here to you. However, I just thought I am going to change the operating system to linux anyway.
|
@marinasaizalia I believe you want to use this one:
|
@tgarc you are right! i didnt even see that before. thanks! |
I have a related problem. In simultaneous playback/record I want to use one ASIO soundcard for input and another ASIO sound card for output or alternatively one of the other Windows API's for input soundcard and the ASIO API for the output soundcard. I need the output to be ASIO because I need flexibility to chose several output channels. When I try to choose two ASIO devices I get the "error opening output stream: incompatible host API stream info". Is what I'm trying to do at all possible? |
It should work in general, but there may be a limitation imposed by ASIO. |
I'm not sure if it works on 2 non-ASIO devices, I will have to check. Maybe it is a limitation with ASIO as you say. |
On linux i can use two different devices import sounddevice as sd
def callback(indata, outdata, frames, time, status):
outdata[:] = indata
with sd.Stream(device=('hw:0,1', 'hw:1,0'), samplerate=(48000, 48000), blocksize=1024, dtype=('int16', 'int16'), latency=None, channels=2):
input() this is Wire.py simplified example. hw:0,1 input and hw:1,0 ouput. |
@davrandom this post gives me a lot help, I also ignored the ASIO driver in the list. BTW, could you share an example of how to specify the corresponding ASIO channel(device), sample rate,blocksize and other parameters, so that the sound can be played though a certain ASIO output channel and recorded by another input one? |
Hi guys, I had a similar problem as @marinasaizalia and want to share my experience with you. Hope that helps some of you. I found out that during installation of ASIO4ALL the option "offline settings" was not available and instead some other, for me rubbish text, was displayed as the last option to check. Therefore, I could not see how and change from 4 pseudo devices going from my fireface 802 via adat1 passing a behringer device to 8 speakers. However, after making the changes within the asio4all settings, i.e. selecting adat1 (1+2), adat1 (3+4), adat1 (5+6) and adat1 (7+8), I could not see any change in the output with sd.query_devices(). No ASIO device showed up as expected. Out of nowhere, the output changed! Do not ask how... May be it is important (I think the manual indicates that) that no other process which uses ASIO should run parallely. I had spyder running and the conda prompt. It is still strange that matlab showed me the new device immediately even though other processes were running in the background.. I cannot explain what happened. I did not make any changes in the sounddevice ASIO settings. However, I expected according to @marinasaizalia experience to be the output something similar to
Instead I got
I got confused because of the "Analog", the "(1+2)" and the "WDM/KS" . A lot to be confused about.. at least for me : ) I got the system running by routing in totalmix Analog (1+2), Analog (3+4), Analog (5+6) and Analog (7+8) to adat1 (1+2), adat1 (3+4), adat1 (5+6) and adat1 (7+8). Cheers! |
I found the solution for my case in some other thread. I think it was here #137 uninstall sounddevice and portaudio with conda and reinstall with pip. sd.query_devices() displays ASIO now. |
@marinasaizalia hello my friend,could u share us the example of how u slove your problems?i also want to use sounddevice to playback some audios and i don't know how to choose the channels(different loudspeaker,i think),thanks a lot! |
I'm not sure if my usecase is different. I've spent a few hours reviewing this now... trying to create aggregate device on windows. I then had a look at Synchronous Audio Router, and used asioconfig to spawn the ASIO.CPL I know (from testing) that on windows 11 I can use both my speakers and headphones at same time... I'd like to try and create an aggregate (output) device, so apps using it and directing sound to pin1 sends to headphones, Even with VAC this doesn't look seem possible! Am I overcomplicating, or trying to achieve the seemingly impossible? A workaround may be to use a cli_tool like nircmd to dynamically target the device, but I'd love to see if it's possible to use pins-as-devices on a virtual aggregate device. |
Use case: two devices with m and n channels (in and/or out). I want to use the channels of both (m+n) to output and/or record.
Is this possible?
The real use case is less weird than this, I'm on windows and WDM is splitting a multichannel interface into several separated interfaces.
ps: And yes: asio would solve the problem, but I'm under cygwin and cygwin's portaudio doesn't have asio support apparently. There are other solutions, like using conda/anaconda, there it works. Anyway I think the question still makes sense.
The text was updated successfully, but these errors were encountered: