psychopy.org | Reference | Downloads | Github

How to randomize order of sound clips and make it such that the same file type is not repeated?

Trying to build an auditory comparison experiment on Builder. For each trial, two clips would be played sequentially: a sound wave, and a sham. The participant’s task is to select which clip contained the sound wave.

How can I randomize the order (whether the sham appears first or second), and also restrict repetition of conditions (e.g. trials won’t have 2 sound waves, or 2 shams), such that each trial always has a sound wave and a sham, in randomized order.

Thank you!

Hi @wiliang

Sounds like one easy way for you to do this would be for you to use two Sound components during your rountine. Let’s say they would be called SoundOne and SoundTwo.

You could set it so SoundOne starts at the beginning of the trial (Time 0.0) and that SoundTwo starts on the condition that SoundOne has completed or after a set period of time (e.g., 2 seconds). Put a loop around this routine and call it something like “trials” and attach your conditions file. In this file you will need two columns with the list of SoundOne files and SoundTwo files for each trial. Give these variables a name (e.g., SoundOneFiles, SoundTwoFiles). In each component, your sound file can be drawn from these variables.

It sounds like you basically need create a list of all possible trials that you want to occur and set them up in the conditions file. To randomise them, set the “trials” loopType to random.

1 Like

@neurowink Worked perfectly, thanks so much!

1 Like