Unique music clips for participants

URL of experiment: Ellen Murphy / Where What When-Online task · GitLab

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_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.


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

1 Like

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

1 Like

Thnx @sotiri! Let me see what you did there…

Thanks so much for your help! I have implemented those changes, and now the experiment is running but instead of the music playing where it is supposed to, there is just an audible beep (around 1 second long) followed by silence. It’s not an issue with the sound files because I managed to have music running prior to trying to have individualized music playing. There is no error message and the experiment runs as normal, just with no sound. Have you any experience of this happening?

No worries, let me take a look, x

Hi There,

Here is a solution you could use with minimal code.

Group A are presented with one sound file and group B another.

run link: https://run.pavlovia.org/lpxrh6/unique_sounds
project files here: Rebecca Hirst / unique_sounds · GitLab

Hope this helps!