psychopy.org | Reference | Downloads | Github

Keep getting "unspecified javascript error" (not the IAT!), sound issue?

URL of experiment: https://pavlovia.org/lderuiter/ratingexparabic
On git: https://gitlab.pavlovia.org/lderuiter/ratingexparabic

OS: 10.14.6
Browser: Firefox 74.0

Description of the problem: This is a rating experiment in which participants need to rate a sound stimulus. It all works fine up to the “getReady” routine (the one timed for 1 sec). The text gets displayed (in this case just “*”, but I have tried other text to check), but then it throws an “Unspecified JavaScript error”. The displayed text remains on the screen, and you cannot advance the experiment.

Because the error is unspecified, I’m not sure where to start. I was wondering if it could have to do with sounds, because from reading other people’s issues it seems that these can be iffy, but on the other hand I didn’t get a specific sound stimulus error message, so it may be something else. All sounds are .wav files.

Any pointers would be highly appreciated!

It looks like the experiment is private so there is no way to see any of the code. If possible could you make it public then I would happily take a look.

1 Like

Oh, thank you for pointing that out! I’m trying to find out where I can make it public

In the gitlab repository, go to settings -> general, it’s under permissions.

Thank you! Done!

Just in doing some early exploring, it looks like the unspecified Javascript error is due to the sound component (in builder if you click on a component, there is a tab called testing, and you can disable that component, resync and try to pilot it. Makes it very helpful for confirming problematic components).
Another error seems to pop up though related to the code. It looks like mouse.isPressedIn() is not a function that currently exists in PsychoJS (https://psychopy.github.io/psychojs/module-core.Mouse.html) so even when the sound was removed this also was throwing an error. I don’t use mouse components often but I’m sure there is a way to recode that code component to work with functions that exist in PsychoJS.
Just wanted to share this diagnostic info right away in case that gives you any ideas towards solutions. I should be able to keep digging at it later today and will post any updates as I come across them.

Hi Bobby,

Thank you very much! My apologies for not getting back to you earlier. This is already helpful. I will try to remove the mouse.isPressedIn() function. Maybe I can just work with the “clickable stimuli”. But that won’t solve the sound issue, I guess (assuming that that’s at least one cause of the error). Do you have any experience with sound problems in Pavlovia?

Thank you again for your help, I really appreciate it!

What start time are you setting for you sound? One user recently certainly broke their sounds by setting the start time as a blank which resulted in JavaScript error

I just removed the whole code component that contained the mouse.isPressedIn() function. as suggested by @Bobby_Thomas, but unfortunately that did not change anything.

Starting time is set at 0.0, so that’s probably not it.

I found out that when the “Sound” in the sound stimulus dialogue is set to a specific sound file (i.e., not a variable), then it works! So for example if I set it to “LEA1.wav” instead of “$sound” (“sound” is the name of the variable/column in the trials excel file), then it plays that sound without problems.

I was wondering if maybe “sound” is not a good variable name, so I changed it to “file” instead. But that results in the same “unspecified JavaScript error”. So it must have to do something with the way the value is set using the trials excel file. Do you have any other ideas?

Update: I removed the entire html folder and synced again, and now it works! I saw that for some reason changing variable name in the html > resources folder (from “sound” to “file”) wasn’t permanent, it always reverted back. So I removed the entire folder, synced, and that did the trick.

So it appears that “sound” is just not a good variable name.

Thank you to both @jon and @Bobby_Thomas for helping me!

1 Like

Thanks and well done for working that out Laura. I wonder if it caused a name clash on JS that wasn’t there for Python. Good for us to know and I’ll look into whether we can provide a warning to stop others having the same issue!