Error message upon sound presentation: InvalidAccessError: AudioNode.disconnect: Trying to disconnect from an AudioParam we're not connected to

Dear community,

We are currently programming an online experiment using the Builder of PsychoPy v2020.1.3 on Windows 10. In order to generate the necessary JavaScript code, we mostly use the auto-translate function, but some code components (for example, some functions dealing with randomness) were translated manually. Here ist the URL of the experiment:

https://gitlab.pavlovia.org/uds_online_studies/wirth/was-gedaechtnis

Description of the problem:
The experiment is a memory experiment that consists of several phases (learning, retention, and test). During the retention phase, participants have to perform a 2-back task where a stream of letters is presented centrally. Participants have to press the spacebar whenever the currently presented letter is identical to the letter that was preceding the current letter by two positions. Otherwise, they must not press a key.
Whenever participants make an error (both hits and false alarms), a brief feedback sound is presented so participants know they made an error. The feedback sound works fine both in the local version and in the online version of the experiment. However, whenever the experiment is run online, the following error message pops up whenever the feedback sound is presented for the first time:

InvalidAccessError: AudioNode.disconnect: Trying to disconnect from an AudioParam we’re not connected to

As I said, the feedback sound is presented as intended and the routine keeps on running without any noticeable issues. However, the error message is of course very distracting (as it occludes the stream of letters) and must therefore not pop up during the experiment.

We already tried to find out which part of the code causes the error using the Firefox Developer Tools. However, the console simply gives out the following two messages:

DOMException: "AudioNode.disconnect: Trying to disconnect from an AudioParam we’re not connected to

FATAL unknown | {}

It would be great, if someone here has an idea what might cause the error and how to fix it!

Many thanks,

Benedikt

Dear community,

we could not solve the problem, but we found a nice workaround. Just in case, someone experiences the same problem in the future, I am posting the workaround here:

In the previous version of the experiment, the error feedback sound was created via code and was played whenever the participant made an error (or to be more specific: The routine that plays the sound was aborted via “continueRoutine = false” when the given response was correct). However, this part of the code most likely caused the error that is described above.

Instead, we decided to create two wav-files, one with the error feedback sound that is played whenever an incorrect response is given and one with a dummy sound (i.e., a very short recording of silence) that is played whenever a correct response is given. With this workaround, the error message described above does not pop up anymore.

Hope that this might be helpful for someone in the future!

Benedikt

Hi Benedikt,

Sorry to bump this thread, I thought it better to continue this topic rather than create a new one.

Thanks for sharing - this almost helped me with a similar problem, however, your workaround does not apply to my problem.

I am running an experiment in which two tones are played, with a time delay between them. After the second tone is played, the routine should end and a slider scale should appear. This works fine in Builder, but not when I pilot the experiment online. Instead, the screen stays blank and does not continue to the scale.

To fix this, I decided to add a code component:

if t>=2:
    continueRoutine=False

This was intended to forcibly end the routine after 2 seconds had passed (which is after both tones had finished playing). Unsurprisingly this led to the same problem you had, where the experiment technically can run, but with the annoying error message.

Does anyone know of another workaround for making sure the routine ends after the two tones are played? I can’t think of any reason why the routine does not end normally when the experiment is run online, when it runs fine in Builder.

Thanks in advance,
Michael

In my crib sheet I recommend creating sound components in the previous routine which start after the routine has already been ended by continueRoutine=False

Then use tone_1.play() and tone_1.stop() to start and stop each tone.

Hopefully this is of use to some people! For me personally, I have managed to avoid needing to use continueRoutine=False by using a .wav file for my tones. Previously I had just entered a frequency and duration, which led to the routine not ending, but using a .wav file doesn’t cause this problem for some reason.

Yes, the other way to set the duration is to have a sound file of the correct length, but that doesn’t work for background noise which you want to last for the variable duration of the trial.