Hallo,
I would like to play a audio file as a go signal and stop signal during a CursorFeedbackTask. In particular before the feedback starts and after it ends. Therefore I have somehow to combine the CursorTask Module and StimulusPresentation Module. Is that the right way??. I manged to play a audio file using a windows function PlaySounds but it is not really fluent because I have to freeze bci2000 for some time until the sound is played. So I think it would be more elegant to use some code from StimulusPresentation Module but I am not sure how to achieve this. Thank you in advance.
Regards,
Vladi
Play audio stimuli in CursorFeedbackTask
Re: Play audio stimuli in CursorFeedbackTask
Hi,
BCI2000 contains a WavePlayer class, which wraps DirectSound on Windows, and uses QSound output on other platforms.
Using the WavePlayer class, you can play sound asynchronously. Just add one object of type WavePlayer for each sound to your task class, and load sounds during initialize. Unfortunately, on Windows versions newer than XP, DirectSound is not so direct any more, and is instead provided through a compatibility layer. That may introduce considerable delay the first time a sound is played through DirectSound. To avoid that, you should create a dummy sound file containing a second of silence, and play that through a temporary WavePlayer instance in OnInitialize().
Regards,
Juergen
BCI2000 contains a WavePlayer class, which wraps DirectSound on Windows, and uses QSound output on other platforms.
Using the WavePlayer class, you can play sound asynchronously. Just add one object of type WavePlayer for each sound to your task class, and load sounds during initialize. Unfortunately, on Windows versions newer than XP, DirectSound is not so direct any more, and is instead provided through a compatibility layer. That may introduce considerable delay the first time a sound is played through DirectSound. To avoid that, you should create a dummy sound file containing a second of silence, and play that through a temporary WavePlayer instance in OnInitialize().
Regards,
Juergen
Who is online
Users browsing this forum: No registered users and 2 guests