psychopy.org | Reference | Downloads | Github

Routine doesn't end after audio file has ended


#1

URL of experiment: https://pavlovia.org/run/sabrinaa_kl/pretest_final1/html/

Description of the problem:
Hello everyone! In my experiment I want to include routines which last as long as the audio files they contain. In the offline version, I, therefore, kept the “duration to stop” in the audio component blank because then the duration of the routine is the same as the duration of the audio file. This worked perfectly fine on the offline version. But as soon as I uploaded it onto pavlovia, the routine doesn’t stop anymore, even after the audio file has ended. I’d be really grateful if somebody could please help me with this.

Kind regards,
Sabrina


#2

https://pavlovia.org/run/sabrinaa_kl/audio_test/html/

I have here a shortened version of my experiment, which only includes the routine with the audio files, because I thought it might make it easier to find any mistakes. I would really need the routine to stop as soon as the audio file is finished because otherwise I have troubles measuring the reaction time of the participants accurately. So, if anyone could help me with this, I’d be really grateful!

Thanks a lot, Sabrina.


#3

Thanks for pointing this out @Sabrina_Klaffenbock, this is something we can fix, but for now you achieve the desired behaviour using a code component with the following JavaScript (where sound is the name of your sound component:

// On every frame
if (t > (sound.getDuration() + sound.tStart)) {
    sound.stop();
    sound.status = PsychoJS.Status.FINISHED
}

#4

I’ve just tried it and it works perfectly! :slight_smile: Thank you!


#5

Just for info, the pull request for this fix can be found here: