In order to use multiple sound cards you will need to do a bit of inline scripting, because it's not supported through the synth and sampler items. One way (maybe not the best, as I personally don't have much experience with this) is to use PyAudio, which is an audio module that is included with OpenSesame. PyAudo let's you specify a device number for your output, which should allow you to use multiple cards at the same time.
Thanks! It works using the code below to index the sounds cards.
Now I am figuring out how to play to a specific speaker...
import sys
import pyaudio
## index the devices in the system
p = pyaudio.PyAudio()
count = p.get_device_count()
devices = []
for i in range(count):
devices.append(p.get_device_info_by_index(i))
for i, dev in enumerate(devices):
print "%d - %s" % (i, dev['name'])
Right, panning seems a bit more complicated than you would expect, using PyAudio and Wave. But the following should do the trick. It's a horribly inefficient way of panning, essentially looping through each chunk and setting one of the channels to 0 before playing it back. But as long as your computer keeps up, this shouldn't be an issue.
Fantastic! Thanks for the reply! I have to admit I was hoping you would have some pointers after having spent an hour 'playing' with this issue. Does increase my appreciation for the pan function in synth- it is very nice and works really well for me for another experiment...
One quick other question, do you happen to know if it is normal that the index for the output_device changes in different sessions? Not a big deal, just means you have to be aware and change the variable accordingly...
Thanks again for your help and have a nice weekend!
I am facing the same challenge as you were I have multiple sound card and I would to play sound on different sound card using pyadio. Seems like you may already have the solution for this . If could please share your information, it will be greatly appreciated .
Comments
Hi Wieske,
Good to see you on the forum!
In order to use multiple sound cards you will need to do a bit of inline scripting, because it's not supported through the synth and sampler items. One way (maybe not the best, as I personally don't have much experience with this) is to use PyAudio, which is an audio module that is included with OpenSesame. PyAudo let's you specify a device number for your output, which should allow you to use multiple cards at the same time.
Cheers,
Sebastiaan
[pastebin:QbnjF4KH]
Check out SigmundAI.eu for our OpenSesame AI assistant!
Thanks! It works using the code below to index the sounds cards.
Now I am figuring out how to play to a specific speaker...
Right, panning seems a bit more complicated than you would expect, using PyAudio and Wave. But the following should do the trick. It's a horribly inefficient way of panning, essentially looping through each chunk and setting one of the channels to 0 before playing it back. But as long as your computer keeps up, this shouldn't be an issue.
[pastebin:q0JZ7hPM]
Also see:
Cheers!
Check out SigmundAI.eu for our OpenSesame AI assistant!
Fantastic! Thanks for the reply! I have to admit I was hoping you would have some pointers after having spent an hour 'playing' with this issue. Does increase my appreciation for the pan function in synth- it is very nice and works really well for me for another experiment...
One quick other question, do you happen to know if it is normal that the index for the output_device changes in different sessions? Not a big deal, just means you have to be aware and change the variable accordingly...
Thanks again for your help and have a nice weekend!
I personally have never worked with multiple sound cards, so I couldn't say. It's a bit odd, but I suppose it's nothing to worry about.
Good luck and same to you!
Check out SigmundAI.eu for our OpenSesame AI assistant!
hi Wieske,
I am facing the same challenge as you were I have multiple sound card and I would to play sound on different sound card using pyadio. Seems like you may already have the solution for this
. If could please share your information, it will be greatly appreciated .
Thanks. Riz