tl;dr
How can I select a random starting point to run range of rows in a csv for each trial? For example, in a twenty line csv, how could I play a sequence of five sounds starting at a randomly selected point from 0 to 15 for that trial and then select a different starting point on the next trial?
MacOS:
v2022.2.5:
What am I trying to achieve?:
I’m trying to create an audio serial response time task where participants respond every time they hear a syllable. The syllables occur at a fixed point in three-syllable nonwords. However, there are four three syllable words that need to be played in a pseudorandomized sequences (words cannot immediately repeat). Further, don’t want the sequences to always begin at a word boundary.
I’ve figured out how to run my training sequences, but for my testing sequences, I want 36 trials and in each trial I want to play a sequence of 48 syllables (ie, the four nonwords four times each in a pseudorandom order).
Because the timing that each syllable begins is important and because of the large number of potential sequences, what seems most logical to me is to create fairly long .csv with all allowable syllable sequences and then just select a range of lines/rows in - Loop - ‘Selected Rows’, with each row instructing Psychopy to play an individual syllable.
The basics of the experiment I’ve worked out and I have an elementary understanding of how to add code to the experiment (I found this useful - Help with randomization). The issue is how to get random fixed sequences to play for the trials.
Screenshots of my Minimal (non)Working Example follow:
The flow randomly selects the syllable to identify, then plays the syllable (this works), then plays the sequence in which to identify it (this doesn’t work).
See below for the rest of the Builder screenshots
I was getting an error that said:
TypeError: object of type ‘numpy.int64’ has no len() psychopy
But now the problem is:
Any help would be appreciated, or if someone could direct me to an example experiment that is closer to what I’m looking for.
Best,
Brian