| Reference | Downloads | Github

Audio file order

In builder, how do you set it so a default/first audio file in the list is played each time before randomizing the remainder of the audio files?

Builder doesn’t provide for this directly. i.e. it can’t implement simple graphical settings for any of the myriad ways someone might want to apply constraints to a randomisation schemings. Such customisation would require some code to override the normal Builder randomisation, or that you simply insert another routine which has the fixed filename as the sound file to play.

e.g. insert a code component from the “custom” components panels. In the “begin routine” tab, you could insert code something like this to override the automatically chosen audio file, solely on the first (i.e. zeroth trial):

if your_loop_name.thisN == 0: # on the first trial only
    your_audio_filename_variable = 'some fixed filename.wav'
    # overwrite what would be the automatically written filename
    # in the data file:
    thisExp.addData('your_audio_filename_variable', 'some fixed filename.wav')

This does what you need to an extent. i.e. note that we are just over-writing what would have been the randomly chosen filename for that trial, so that trial is effectively ignored. So if your conditions file contains, say, fifty sound file names, only 49 would be presented, plus your chosen constant file. This means that one filename would be randomly missing from every session, which may or may not be a concern for you in terms of unbalancing your design.

The alternative would be to include another routine that runs only once, with a fixed filename, followed by your loop of 50 trials. The two routines would be identical other than the first having a fixed value of some fixed filename.wav for the sound file, while the other would contain $your_audio_filename_variable. This is probably the most direct way of implementing what you need, but it might complicate the analysis, as the variable values for that single routine (e.g. reaction time or whatever you are interested in) will end up in different columns in the data file to the variables from the main routine.