You don’t need to use Coder: instead you can insert a code component in Builder. This allows you to have the best of both worlds: use the graphical interface of Builder yet be able to add some flexibility by inserting a few snippets of code to run at the correct time as required.
In this case, let’s say you have the typical PsychoPy arrangement where you have a single conditions file that collects all the information for a given trial together on the same row. So you might have three columns specifying the possible sounds that could play on that trial. Let’s say those columns are labelled
sound_3. So you insert a code component, and in the ‘Begin routine’ tab, insert something like this:
# choose one of the three variables:
chosen_sound = np.random.choice([sound_1, sound_2, sound_3])
# record the result in the datafile for analysis purposes:
Then in your sound component, you can just put this in the Sound field, set to update on every routine:
Make sure the code component is above your sound component, so that a new value is selected for the current trial before the sound component needs access to it.