kurokida / jspsych-psychophysics

A jsPsych plugin for psychophysics
https://kurokida.github.io/jspsych-psychophysics/
MIT License
51 stars 13 forks source link

Concurrent presentation of images and sounds #43

Closed marco2gandolfo closed 1 year ago

marco2gandolfo commented 1 year ago

Thanks for this wonderful toolbox!

I am using jsPsych 6.3.1 alongside jspsychophysics 2.3.4 to present images together with sounds. Particularly, the sound stays on as long as an image (2 seconds) on screen. After that, a mask and a probe image follow. Everything works well on a local server, but when I push my experiment online on pavlovia I get the following error:

image

It is worth noting that this error occurs randomly, causing the image concurrent to the sound to freeze. Also, this error does not always occur, in some cases the script runs just fine ! This led me to think that may be something on the server side (pavlovia), but I thought I'd ask here as well.

I am not sure I fully understand the nature of this error. On my side I tried several times to change the audio files (thinking that those I was using were somewhat corrupted), to compress them from wav to mp3, and to rename them. But it seems it does not relate to my coding.

Thanks for any help you could provide.

kurokida commented 1 year ago

Thank you for using my plugin!

Can I access the program page? Could you show me the URL?

Or, do you have an idea to upgrade the latest ones of jsPsych and my plugin?

marco2gandolfo commented 1 year ago

Dear Daiichiro, Thanks a lot for your reply!

This is the URL for the study

I considered updating many times, but I would have a lot of code to rewrite and I never had to do it so far, perhaps is a good time to do so. Do you think that would improve the audio - image concurrent presentation?

My thoughts about this were that it might be a strange interaction with the server being slow in the last few weeks, however the audio files are all preloaded, so I don't see why they should freeze because of the server (pavlovia) being slower than usual.

Thanks again.

kurokida commented 1 year ago

Dear @marco2gandolfo ,

I think this issue was solved at this commit https://github.com/kurokida/jspsych-psychophysics/commit/5f17c49d1eb481e2b4a67d0181bdcbdb8858ea21

This has been fixed since version 3.2.0 of my plugin, but to use it you must upgrade to jsPsych V7. This may be a time-consuming and tedious process, but I would recommend upgrading.

If you want to avoid the upgrade, set the use_webaudio property of the init function to false. See this page for more information. You should use the webaudio for experiments where time control is important, but disabling the webaudio may solve this problem.

marco2gandolfo commented 1 year ago

Dear @kurokida Thanks a lot, I will definitely upgrade for the next work. I tried to set the use_webaudio property to false and now everything works. In my case, where the image is presented for seconds, timing does not seem to be an issue (at least qualitatively speaking).

Thanks again for your help and for the info - very helpful!

Cheers, Marco