psychopy.org | Reference | Downloads | Github

How can we randomize three components in a routine?

Hi everyone. In my experiment I have a routine containing three sound components that read different columns of an excel file. I need these columns to be played at random so I need to randomize these components. Does anybody has an idea about that?

Hi Zhaleh,

It sounds like this could work for you: Blocks of trials and counterbalancing — PsychoPy v2021.1
I recently used that to randomize two blocks of movies.

You could set up each of your columns in the excel file as a separate file. Then use something like this chooseBlocks.xlsx to randomize the three blocks.

Hi @MNentwich . Thanks for your answer. I looked at the link you sent to me but they didn’t seem to help me!
I also looked at the .py file of my experiment and saw this:

sound_1 = sound.Sound('A', secs=-1, stereo=True, hamming=True,
    name='sound_1')
sound_1.setVolume(1.0)
sound_3 = sound.Sound('A', secs=-1, stereo=True, hamming=True,
    name='sound_3')
sound_3.setVolume(1.0)
sound_2 = sound.Sound('A', secs=-1, stereo=True, hamming=True,
    name='sound_2')
sound_2.setVolume(1.0)

Is there a way to randomize these components through the code itself?

Hi There,

Is it that you want one of 3 sounds to be randomly selected and played?

Becca