How to randomize the presentation of certain stimuli

OS (e.g. Win10): macOS Ventura
PsychoPy version (e.g. 1.84.x): 2022.2.4

I’m planning to use PsychoPy to play a series of audio clips. There are 20 clips total, and I’ve set the experiment up so that the clips will be played in two halves (10 clips, followed by a break, then the other 10 clips). Before each clip I have another routine where it announces the trial # (from 1-20). What I am hoping to do is randomize the routines with the audio clips, but keep the trial routines unrandomized. Is this possible in PsychoPy Builder? Is it using loops?

To explain, the routine order I have is: Trial1, AudioClip1, Trial2, AudioClip2, Trial3, AudioClip3…
Is it possible for the AudioClip routines to be randomized, but not the Trial routines?

Thanks!

Is the only non random part a number? If so then you can just use $'Trial: ’ + str(trials.thisN + 1) in a text component set to update each repeat (if your loop is called trials).

The non-random parts are the trial routines. For those routines I’ve created a sound where it says “Trial 1” or “Trial 2” etc… and after each Trial routine, I created another routine where the audio clip would be played (and these are what I’m hoping to be randomized)

Just as you can use .thisN in a text component, you can also use it in the file name of a sound.

Thanks so much for your reply! How would it work exactly? So i would put .thisN in the file name of the sound. And then I would have a loop around each half? Or each audio clip routine?

I also forgot to mention that I have a routine after each audio clip that just has text and a mouse so I can move forward when the participant is ready. I also would want this to be unrandomized. So, I have the routines structured as:
Trial_1, AudioClip, PauseScreen, Trial_2, AudioClip2, Pause Screen, etc.

I’m hoping the audio clip routines can be randomized, but the trial and pause screen routines remain unrandomized. Sorry if this is confusing. Thank you