Video sound and PsychPortAudio

Hi all,

Because I was helped so well yesterday, I decided to ask another question related to sound. ;)

I am maintaining a task now, in which a few sounds are loaded in the background for use throughout. I am opening audio handles as slaves, which works well now.

However, at some points, we are showing a video (with its own sound!). The video is loaded and played using the 'OpenMovie' and 'PlayMovie' subfunctions. However, this does not seem to work if a PsychPortAudio is used at the same time. Closing the master audio handle is possible, but then I need to reload all the slaves again. Playing the video sound separately through another PsychPortAudio works, but takes way to long to load. And besides, I fear some sync issues in the long run.

Is there a way in which I can specify an audio (slave) handle for the video sound?

We used to run these tasks on a Mac, and there it just worked. But now we're migrating to Linux, and those problems suddenly pop up ...

I hope you guys can help me. Thanks in advance!

Best,
Mark
On Wed, Mar 28, 2018 at 3:02 PM, l.c.m.bruurmijn@... [PSYCHTOOLBOX] <PSYCHTOOLBOX@yahoogroups.com> wrote:

Hi all,

Because I was helped so well yesterday, I decided to ask another question related to sound. ;)

I am maintaining a task now, in which a few sounds are loaded in the background for use throughout. I am opening audio handles as slaves, which works well now.

However, at some points, we are showing a video (with its own sound!). The video is loaded and played using the 'OpenMovie' and 'PlayMovie' subfunctions. However, this does not seem to work if a PsychPortAudio is used at the same time. Closing the master audio handle is possible, but then I need to reload all the slaves again. Playing the video sound separately through another PsychPortAudio works, but takes way to long to load. And besides, I fear some sync issues in the long run.


That's unavoidable atm. with our current implementation on both Linux and Windows if you want timing precision. Our macOS implementation allows this parallel opening of the sound device, but timing precision may suffer in random ways, so doing that under macOS doesn't lead to an obvious error abort, but can compromise the audio timing of your experiment in a similar way --> Not recommended.

However, closing and reopening audio master/slave devices should be reasonably fast. If you use PsychPortAudio's 'CreateBuffer' function to upload sounds for playback, then you can do that without specifying a 'pahandle' so that should survive individual closing and reopening of audio devices if i remember correctly. I'd assume that's where most of the time would be spent in setting up everything again.

Is there a way in which I can specify an audio (slave) handle for the video sound?

No.

We used to run these tasks on a Mac, and there it just worked. But now we're migrating to Linux, and those problems suddenly pop up ...


Audio is probably the last bit they didn't screw up for use yet (if we exclude all the problems external USB audio devices and pro audio apps seem to have after each new OSX release, because Apple apparently can't get USB right). But as i said, keeping both video+audio playback and PsychPortAudio open at the same time on the same sound device is not recommended at all on macOS either, as it can lead to timing issues.

-mario

I hope you guys can help me. Thanks in advance!

Best,
Mark