| Reference | Downloads | Github

How to define sound online?

URL of experiment: Pavlovia

Description of the problem:
I have a sound file that is played once per trial. It is triggered by different events depending on the condition.

I was defining the sound in the code with this in the Begin Experiment tab:

tone = sound.Sound('tone.wav')


However, I received this error message online:

And found that defining sound in the code doesn’t work. So I have created a sound component.
However, I’m unsure what to set for ‘start’ and ‘stop’.

Screenshot 2020-07-15 at 11.54.00

What should I put here?

Thank you!

I normally create the sound component in the previous routine an put the start time as a large number (e.g. 10 seconds) and end the routine in code. The Stop duration should be blank.

Then start and stop the sound using and tone.stop()

1 Like

Thank you so much! Works perfectly!