psychopy.org | Reference | Downloads | Github

Unique music clips for participants

URL of experiment: Ellen Murphy / where what when ONLINE TASK · GitLab

Hi,
I’m quite new to psychoPy and I was wondering if anyone could offer some help.
I’m working on an experiment where I want participant-specific music to play while particiapants complete a task. Participants would have to enter their unique code at the beginning of the experiment (expInfo), which would then lead to music that is specific to that code playing during a specific section of the experiment.
As startup code for the experiment I used the following:

if (expInfo == RYA2409){
my_songs = [];
my_songs.push(“sound/test-file.wav”);
my_songs.push(“sound/131-looped.wav”);
shuffle(my_songs);
my_song = my_songs[0];
}

However I got the following error when trying to run online:

Please excuse my lack of knowledge, but would be very grateful if anyone has any tips on how to do this.

if (expInfo[‘participant’] == “RYA2409”)

However, I strongly recommend that you use Auto code components and code in Python wherever possible, unless you are much better at coding in JavaScript than Python.

Thanks a lot for your reply.

I changed my code to the below image:

However, I’m still getting the following error

I cant seem to figure out where I’m going wrong.
Thanks for your advice, I’m definitely not better at JavaScript so will try to do that in the future.

Heya!

This problem has to do with the stimulus not being downloaded. I’m trying to figure out how you could solve this elegantly, but I don’t have an answer yet. Hang on.

Best, Thomas

Hi @ellenmurphy, I have created a support fork to address the syntax errors in your project. In particular, Room_1 / code_8 line 1 and Room_practice / startup_code lines 12 and 19 needed tweaking. Please let me know if any problems remain, x