Description of the problem:
The experiment works locally in builder (minus some images are currently missing from the local directory to save space). When I try to run on Pavlovia I get the dreaded unspecified javascript error. I get the same error in firefox and chrome, but in chrome I also get a “failed to load resource” error, but it doesn’t say which resource.
I think maybe the problem is related to feedback sounds, and I have tried to follow all the recommended do’s and don’t’s about playing sounds in psychoJS, but I still can’t find the problem (and the error gives me zero information!).
That’s not the same thing. They may be online, but not loaded into memory at the start of the experiment. Does the number of resources you see getting downloaded look right?
I haven’t counted the number of files, but I did notice that the list of resources which are loaded does not seem to include the sound files, only the images.
I’m trying to create another version of the experiment without the large collection of images for the main experiment, for faster debugging. I’ll post a link as soon as it’s created.
Have you looked at Experiment Settings / Online in Builder?
Resources that PsychoPy knows it needs are automatically loaded into memory at the start of the experiment. However, any that are defined in code or in Excel files that are themselves defined in code need to be manually added (either there or on the fly).
Ok, in the small version I just posted I’ve fixed some bugs and re-confirmed it’s running locally. Now when I load that into Pavlovia I can see that it’s definitely loading all the correct resources, but I’m still getting the same error.
Yes, it works if I comment out those lines. However, I had previously set it up with sounds as components but had run into the problem that components can only be played once per routine, and I would like to be able to replay the same sound every time a key is pressed. Is there a way to do that with components?
The path should be either just the name or sounds/fileName.mp3 as you had it.
However, I notice that your Python just has numbers. Have a look at my Music Box demo to see that you can play sounds online with frequencies (but not letter notes without translation).
Yes, I am just trying to play conditional feedback sounds. I’ve just looked at your music box solution and it seems like it requires that the sound lasts for the entire routine, right? That will require some significant restructuring of my experiment.
You should be able to start and stop the sound in code once it has been created. What I wasn’t able to do was change the note of a sound (setSound) within a single routine. However, since you only have three sounds you should be able to create them all and play/stop the relevant ones.