Hi,
I think I managed to solve the issue, and have an online experiment with a continuous sound. The solution is a bit messy, and I got it playing a bit randomly, but it is working.
Basically you have to do the following steps.
1) Create a code snippet for the continuous sound
1a) First, in the Begin Experiment tab, I created manually this code, selecting JS from the dropdown menu.
background_sound = new sound.Sound({
win: psychoJS.window,
value: 'traffic.wav',
secs: -1,
});
background_sound.setVolume(1);
1b) Then I created in the Begin Experiment this line of code selecting the Py code from the dropdown menu.
background_sound = sound.Sound('traffic.wav')
1c) Finally in the Begin routine tab play the sound, selecting Py code from dropdown menu.
background_sound.play()
NOTE: the step 1b could seem redundant, but for some reasons without this step, the solution won’t work (I assume it is related to the automatic conversion to JavaScript).
These 3 sub-steps so far should make the code work locally. But to work online you need another step
2) Copy manually your continuous file (i.e., 'traffic.wav'
in the example) in the html/resources
folder of the project
I noticed that the file was missing from this folder, so I manually copied it.
This solution worked fine for me. Locally it worked also if there were other auditory stimuli during the background noise. But online it gave me some java script errors and did not worked. Online it worked only with a background sound and visual stimuli in the experiment.
Hope this helps
NOTE: i edited and reposted the comment adding some missing info after deleting it.