| Reference | Downloads | Github

Play random segment of .wav file

Good afternoon and thank you for reading!

I am hoping to play two separate .wav files simultaneously for an intelligibility experiment; one file is the speech stimulus and the other is babble noise. The catch is that I would like the experiment to randomly select a portion of the babble noise to play along with the speech stimulus file (to avoid the same segment of speech babble playing with each speech stimulus clip).

I have been able to create an experiment where the two sound files are presented simultaneously; however, the babble .wav file always plays from the beginning of the file; I would like for PsychoPy to randomize from when within the babble .wav file it plays. Is this possible? I am still a novice with programming but starting to get my feet under me. I am using the Psychtoolbox sound engine if that matters.

Any suggestions would be very much appreciated. Thank you and have a nice day!