-
Notifications
You must be signed in to change notification settings - Fork 145
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
Capturing several devices simultaneously #154
Comments
I do not have any real experience with using the Your option 1 will definitely not work. The Your option 2 might work. If you need help avoiding the exception you were mentioning, you should provide some code. If I can reproduce the problem I might be able to help, but no guarantees! If your option 3 does what you need, that's fine. But I think if option 3 works, the same thing should also work with Depending on your OS and host API, it might also be possible to create 4 Yet another option would be to try to combine the input devices with some OS tool. For example, on macOS it is possible to make an "aggregate device" by combining multiple existing devices. |
Hi @mgeier, thanks for your response. At this moment I had a project switch but hopefully next week I will be able to provide some code. In the meantime, I will explain what I need to do: I have a soundcard with 4 inputs (4 devices), each one with 2 channels. There is needed to start and stop recording on each channel based on external events. (suppose a GUI with 8 start and 8 stop buttons). In the first stage of development, I have a fixed recording duration, so I can avoid stop buttons and start recording using start buttons. For that reason my approach 3 is working; with each start button, I can run the recording script for the respective device. This implies I will start recording both channels when one is requested. I will provide the code as soon as I can. Thanks. |
A similar question on Stack Overflow: https://stackoverflow.com/q/54036977/. |
@gustavovelascoh Any news? |
Sorry, I totally forgot this thread. In the end, I created a thread class based on the "Recording an arbitrary duration" example, in which I can select the device when an object is created, and added methods for start and stop the recording, and change the destination file. From the main process, I create the needed recording objects and control the recording based on the external asynchronous events. |
OK, thanks for the update! I guess I can close this issue now. If you have further questions, feel free to open further issues or add comments here. |
Is it possible to record from several devices simultaneously?
I have 4 devices and I want to capture simultaneaously from them. I have tried 3 approaches in this order:
1. Consecutive calls to
sd.rec()
:Tried something like:
But plotting the data (4 outputs concatenated) I got this. Just device 4 is fully recorded:
2. Multiprocess:
I wrapped sd.rec() function in a new one, and tried to use it via multiprocess, but got the "freeze_support" error:
error.txt
3. subprocess (isolated recording script)
Finally I opt to create a python script for recording having as input the device number, and use a "master" script to call it with the required devices, and it works. Something like:
The only caveat here is that I can't stop or handle the recording once it has started because, obviously, this is a new process in the OS.
Is there any approach more related to my attempts 1 and 2 for recording multiple devices?
The text was updated successfully, but these errors were encountered: