Playing sound in Pavlovia

Hi,

I am having a tough time to play sound in my online experiment.

I designed a simple experiment (a series of letters appear on screen for 1 second each and at the same time a tone is played) which is in PILOT mode. It is running fine offline in the Builder, but I have encountered a problem in Pavlovia:

  • If I use a Sound component to implement the tone, it is just played once at a random instant during the experiment, instead of being played every time a letter is shown on screen.

  • If I use a Code component to create the tone (which I read is best), I get the error ‘‘ReferenceError: sound is not defined’’ which I believe is due to a wrong automatic translation from Python to JS by the Code component.

I am using PychoPy3, PTB as audio backend and audio mode 3 (Agressive low latency).

What Python code are you using for the sound? What does it translate to?

Used:

@ Begin experiment:

mySound = sound.Sound('A', secs = 0.150)

@ Begin routine (the routine that displays the text):

mySound.play(when = ptb.GetSecs())

which translated to:

mySound = new sound.Sound("A", {"secs": 0.15});
mySound.play({"when": new ptb.GetSecs()});

Hey, @wakecarter,

sorted the problem by creating a tone .wav using Python and then pointing the Sound component to the file. Nonetheless, I am struggling to find a way to log the onset/stopping time for the audio to check it is correctly played.

Thanks for your support.