Dynamic Sound component not playing online in PsychoPy 2026.1.3

PsychoPy 2026.1.3, macos tahoe 26.4.1, Safari browser

A Sound component with a dynamic value ($voice_context, set every repeat) works correctly in local PsychoPy but fails to play online. The sound property dropdown is grayed out in Builder despite the variable syntax being correct.

Inspecting the .psyexp file directly confirms updates=“set every repeat” is set correctly, so the gray dropdown appears to be a display bug in 2026.1.3.

Debugging via console revealed that while voice_context holds the correct file path at Begin Routine, the Sound component’s internal value is undefined, meaning it never receives the dynamic variable at all. This suggests the Sound component is initializing before the variable is assigned, and “set every repeat” is not functioning online.

Attempting to construct the Sound object manually via a Code component:

javascript

voice_sound = new sound.Sound({

win: psychoJS.window,

value: voice_context,

secs: -1

});

played correctly on the first loop but not subsequent loops. Further debugging showed the psychoJS object reference becomes inconsistent across loops, and attempting to reset the sound status failed because PsychoJS.Status is undefined.

Workaround: Bypassing PsychoJS sound entirely and using the native Web Audio API resolved the issue:

javascript

if (typeof audioCtx === ‘undefined’) {

audioCtx = new AudioContext();

}

if (typeof voiceSource !== ‘undefined’) {

try { voiceSource.stop(); } catch(e) {}

}

voice_context_finished = false;

fetch(voice_context)

.then(response => response.arrayBuffer())

.then(buffer => audioCtx.decodeAudioData(buffer))

.then(decoded => {

    voiceSource = audioCtx.createBufferSource();

    voiceSource.buffer = decoded;

    voiceSource.connect(audioCtx.destination);

    voiceSource.onended = function() {

        voice_context_finished = true;

    };

    voiceSource.start(0);

})

.catch(err => console.log("audio error:", err));

Questions for the community:

1    Is the grayed-out dropdown for dynamic Sound properties a known bug in 2026.1.3?

2    Is there a proper fix planned so that dynamic Sound components work reliably online without needing a Web Audio API workaround?

3    Is the inconsistent psychoJS object reference across loops a known issue?

This is a feature, not a bug. Sounds are never programmatically constant, so the option to change from “set every repeat” is only available if you have a static component.

thanks for your reply!

Practically i placed a static sound starting from 0.0 before the dyanmic one which starts from 1.0, but every loop heard that static but never the dynamic one.

I DID place the assignment of sound before the routine it was placed, like sound_context=" media/onesaystoother.wav", the problem kept. or did you mean an operation other than simple assignment?

for the sound component, even i changed the sound to be static, it kept gray.

Try removing the duration. The sound file already has a duration.

This is what I mean by a static period.

Your screenshot shows me that you don’t have one. However, ming.mp3 should be fine because it doesn’t start at time 0

thanks for your advice!

i placed the ‘resource manager’ and added one wave file, but as i reopened the routine and click on this manager, psychopy popuped error message and collapse:

Traceback (most recent call last):
File “/Applications/PsychoPy 2.app/Contents/Resources/lib/python3.10/psychopy/app/builder/builder.py”, line 1977, in OnMouse
File “/Applications/PsychoPy 2.app/Contents/Resources/lib/python3.10/psychopy/app/builder/builder.py”, line 2702, in editComponentProperties
File “/Applications/PsychoPy 2.app/Contents/Resources/lib/python3.10/psychopy/app/builder/dialogs/init.py”, line 1779, in init
File “/Applications/PsychoPy 2.app/Contents/Resources/lib/python3.10/psychopy/app/builder/dialogs/init.py”, line 809, in init
File “/Applications/PsychoPy 2.app/Contents/Resources/lib/python3.10/psychopy/app/builder/dialogs/init.py”, line 645, in init
File “/Applications/PsychoPy 2.app/Contents/Resources/lib/python3.10/psychopy/app/builder/dialogs/init.py”, line 482, in init
File “/Applications/PsychoPy 2.app/Contents/Resources/lib/python3.10/psychopy/app/builder/dialogs/init.py”, line 490, in addParam
File “/Applications/PsychoPy 2.app/Contents/Resources/lib/python3.10/psychopy/app/builder/dialogs/init.py”, line 132, in init
File “/Applications/PsychoPy 2.app/Contents/Resources/lib/python3.10/psychopy/app/builder/dialogs/paramCtrls.py”, line 264, in new
File “/Applications/PsychoPy 2.app/Contents/Resources/lib/python3.10/psychopy/app/builder/dialogs/paramCtrls.py”, line 101, in init
File “/Applications/PsychoPy 2.app/Contents/Resources/lib/python3.10/psychopy/app/builder/dialogs/paramCtrls.py”, line 1469, in makeCtrls
File “/Applications/PsychoPy 2.app/Contents/Resources/lib/python3.10/psychopy/app/builder/dialogs/paramCtrls.py”, line 1511, in setValue
File “/Applications/PsychoPy 2.app/Contents/Resources/lib/python3.10/wx/core.py”, line 2584, in _ItemContainer_SetItems
TypeError: ItemContainer.Set(): argument 1 has unexpected type ‘str’

besides, i had tried to add wave files to the experiment properties>online>additional resource, no errors, but the wave files could not be played as before.

one more thing to add: after that collapse, psychopy could not compile to browser any more