Hi guys,
I am building an experiment (version 2.10, standalone) where participants must create a signal by pressing a mouse button. It’s one of these things that work fine locally, but not online.
The critical part is that they can test whether the apparatus works: they can try it out and click multiple times in the test round. So, basically, they click --> sound is played, they release --> sound stops, click again and sound is played again, etc.
When I try this in my pilot online, the sound seems to ‘pile up’: it sounds as though multiple instances of the sound get played at the same time.
Here’s my JS code:
if ((! (testsound.status === STARTED))) {
if (mouse_2.getPressed()[0]) {
testsound.play();
}
} else {
if ((testsound.status === STARTED)) {
if ((! mouse_2.getPressed()[0])) {
testsound.stop();
}
}
}
The sound component is set to ‘set every frame’, so for every frame, it checks whether the mouse is being clicked or not.
I’m not sure what’s causing this; like i said, it worked locally before… I feel like it needs something to clear the presses, but clearEvent() does not work.
-Sabine
Cool study! It looks like your desktop project is using the latest PsychoPy, but the HTML export is set to an older, pre 2020 version. You can choose which version to target for online use via the settings dialog below,
