One background music during a loop

You need to use some tiny code snippets here to do this, as all Builder stimuli are designed to start and stop within a routine, while you want one that will span multiple iterations over a routine.

Insert a code component on the routine where the sound will play. In the "Begin experiment" tab, insert code something like this to create the sound object in advance:

background_sound = sound.Sound('your_sound_file.wav')

In the "Begin routine" tab, put something like this, so that the sound starts playing, but only on the first iteration:

if your_loop_name.thisN == 0:
    background_sound.play()

I guess you might also need to stop it after the 90th trial, so put something like this in the "End routine" tab:

if your_loop_name.thisN == 89:
    background_sound.stop()
1 Like