How do I make a sound appear on the first trial only?

In the experiment I’m building, the subject sees an image (there are 20 total images) for 20 seconds and after that has to answer a question. I’d like to play a sound while he’s watching the first image, but not the others. I would create a two different routines and use a loop for the remaining 19 but I’d like to have all 20 in the same loop because I need them to all come randomized from the same list. How can I achieve this?

You could have a start condition for the sound component of trials.thisN == 0

Does the routine normally end on participant interaction? If it has a timeout, you might need to add that to Routine Settings to account for the sound component never ending (when it doesn’t start).

The start condition works, thank you! My problem is that (I forgot to mention it in my post, sorry) the sound should play 10 seconds after the image started. If I set the condition, the sound starts instantly. What can I do?

When does the image start?

0.5 seconds (before that i have a fixation cross)

Try this

Begin Routine

playSound = False

Each Frame

if playSound == False and t >= 10.5 and trials.thisN == 0:
     playSound = True

Then set the sound component to start on condition playSound

Seems to work, thank you so much!