| Reference | Downloads | Github

Audio stimuli not playing online

URL of experiment:

Description of the problem: I have created an experiment using PsychoPy builder, and everything works perfectly on PsychoPy. The stimuli used following the sequence of experimental block: 1)video stimuli; 2)video stimuli; 3)video stimuli; 4)audio stimuli. I, then uploaded it to Pavlovia. When I tried testing it online, everything is fine, except the first stimulus of the last block, which I use audio stimuli on that block.
I tried to push file again, it still doesn’t work.

Any suggestions or helps would be really appreciated.
Thanks in advanced.

What audio stimuli are you using? What error (if any) do you get in the console?

I am using .wav audio and all of the audio are only 2 seconds long.
If not mistaken, there’s one error I always get when the first audio doesn’t play
This is the screenshot of the console:

I tried to move the code I inserted for the audio stimuli to the top of the routine. It worked at first. But after I made changed on instructions (in previous routine), it fails again. It became a ‘beep’ sound and overlapped with the other stimuli on the rest of the trials.

Do other audio stimuli work?

Are you creating the audio stimuli in code?

I’ve found it better to create audio stimuli with a component and then control the timing in code.

The other stimuli work, but there is another stimuli playing on the background and causing the overlapping of audio.

No, I used the audio component in Psychopy builder and set the duration.
for the screenshots:
The audio routine

The code for audio stimuli on begin routine and end routine:

You shouldn’t use in the same routine as the audio component (since the component will also force it to play).

Can you simply have the audio component with no code and no duration (play audio until the end is reached).

Okay, I will try that and get back to you later.
Thank you for the suggestion!

Update: I just tried running it without the code and duration. The audio does play without ‘beep’ sound and overlapping, but it return to my initial problem, which the audio doesn’t play on the first trial of this block. I am really clueless on how to solve this :frowning:

Please could you show your audio component?

Yes, here’s the screenshots.

Is sti_aonly a column name in a spreadsheet pointed to be a loop which surrounds this routine?

Yes, it is.

Are you using any variables in the loop definition, specifically for selected rows?

I only set the nResp as 4, the selected rows is remained as empty.

Try putting the start time of the audio component to 1 second.

The only thing I can think of is that the audio takes so long to load on the first iteration that it “misses the boat”. I’ve experienced something similar with video components.

I tried on that, unfortunately it doesn’t work on my case.
But audio plays when changing the sequence of third block (the block just right before audio block) and this audio block.

But, thank you so much for giving these suggestions! I’m really appreciated it

The third block contains the video, doesn’t it?

Does the experiment move straight from video to audio stimuli?

Try adding a gap routine (1 second of blank screen – a text component with a space) to allow for separation between the video and audio.

Yes, the third block contains video.

Actually I have inserted a gap routine as instruction before the start of audio block.

Try using the “expected start” section in the audio Properties window (set it just as you would with your regular start time). This worked for me.