This will likely require you to insert a code component and use a little Python code to add the control that you need. This could be as simple as choosing a random number between 0 and 5 at the beginning of the loop. On each subsequent trial, you check to see if the current trial number equals that value, and if so, play the sound. e.g. put something like this in the “Begin routine” tab of that code component:
if your_loop_name.thisN == 0: # only on the first trial:
sound_trial_number = randint(low = 0, high = 6) # actually gives a value between 0 and 5
# record this in the data file on the appropriate trial number:
if your_loop_name.thisN == sound_trial_number:
thisExp.addData('sound_trial_number', sound_trial_number)
else:
thisExp.addData('sound_trial_number', None)
Then in your sound component, you could put something like this in the volume field to check for a match with the current trial number:
your_loop_name.thisN == sound_trial_number
This boolean comparison results in a volume of 0 when the two numbers are different and 1 when they are the same.