On demand stopping of an audio file while it's being played.

Dear all:

Maybe you can help me on the use of the PsychPortAudio Driver.

Using a GUI interface (Matlab), I can't stop an audio file while it is being played.

It seems that the 'Start' function does not frees the script to go to the next line (where the 'Stop' is located) untill the audio file reproduction has finished.

Do you know how can I stop the audio file while playing on demand, by pressing a handle.stop Button?

Thank you very much in advance.

Alejandro.
--- In psychtoolbox@yahoogroups.com, "alejandrobidondo" <abidondo@...> wrote:
>
> Dear all:
>
> Maybe you can help me on the use of the PsychPortAudio Driver.
>
> Using a GUI interface (Matlab), I can't stop an audio file while it is being played.
>

You should be able to do so, that is the default behaviour of PsychPortAudio('Stop', pahandle); although this and the exact way of stopping output can be controlled via optional parameters, as described in PPA's Stop? help.

> It seems that the 'Start' function does not frees the script to go to the next line (where the 'Stop' is located) untill the audio file reproduction has finished.
>

Nope, unless you set the 'waitForStart' flag to 1 in which case it will wait for start of audio. Also you'd need a broken operating system/sound card that doesn't report back when sound has started.

If you are on MS-Windows without a suitable ASIO sound card, this could probably happen, the standard sound drivers are very deficient for any serious use. Does BasicSoundOutputDemo work and abort after a 1 second key press? Does PsychPortAudioTimingTest work? This would be good tests...

-mario

> Do you know how can I stop the audio file while playing on demand, by pressing a handle.stop Button?
>

See above.

> Thank you very much in advance.
>
> Alejandro.
>