URL of experiment: Pavlovia
Description of the problem: In my experiment, participants will hear a soundfile triggered by a keypress (return). Running it online I get ‘Unspecified JavaScript error’ when pressing the key. All suggestions I found here about this error did not help 
thanks in advance!
I just had a look at your code and couldn’t work out why you are shuffling soundfile every frame. It seems to only have one entry and doesn’t seem to do anything. Nor does playsound.
Also, shuffle needs to be defined in JS. Please look at my crib sheet (see pinned post).
Best wishes,
Wakefield
Hi Wakefield,
Thanks for looking into the code! I think the problem lies in the translation to playsound (I deleted the shuffle code for now). However, how do I translate the function into js?
My Py code: if Trial_resp.corr:
playsound = soundfile
the Auto->JS shows: if (Trial_resp.corr) {
playsound = soundfile;
}
Best,
Fabian
What is playsound for? Does that work in Python? What is soundfile for?
I think what you mean is sound.play() if your sound component is called sound.
playsound works in python and is a command to play the sound ‘soundfile’, which is the name of my audio (before, there’s this code: soundfile = [‘sound_1.mp3’].
so should i replace playsound with soundfile.play() in the JS code?
thanks so much !!