Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[open] two sound cards

edited January 2013 in OpenSesame

Anyone have any experience using two sound cards in OpenSesame? Thanks for help/ suggestions!

Comments

  • edited 11:34PM

    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]

  • edited 11:34PM

    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'])
  • edited 11:34PM

    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!

  • edited 11:34PM

    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!

  • edited 11:34PM

    One quick other question, do you happen to know if it is normal that the index for the output_device changes in different sessions?

    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.

    Thanks again for your help and have a nice weekend!

    Good luck and same to you!

  • rizriz
    edited 11:34PM

    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

Sign In or Register to comment.