psychopy.org | Reference | Downloads | Github

Randomize routine with audio files

win10
PsychoPy3
Hi
. sorry in advance for my english. I’m trying to present sound with numbers. In total there should be 12 trails, contained in 3 blocks of 4 trail each. There were 4 trails each of the 3 different trail lengts (5,9, or 13 digits) and the presentation order was random. or rather in three blocks of four tasks. And before the start of the assignment, “ready” will sound. The question is, how can I randomly achieve the presentation of 5,9,13 numbers in one routine (example 5,9,13,9 in total 4)?
I managed to produce sounds with numbers from 5,9,13. But it doesn’t work that in one block there are like five, nine and thirteen numbers.
Thanks in advance

Hi,

I am not sure if I get your question correctly. I think you have a condition file and you want to randomly present every four rows of the file in a block. If it is what you want, you can create a loop and inside the loop (in builder view) you can set the rows to any numbers that you want (e.g., 5,9,13,19). This way, in that block, only those rows will be presented to participants.

Hey. Thank you very much for your response. I will try to answer more clearly. I created a magnifying glass as can be seen below, but in the “selected rows” when specifying the necessary ranges 5,9,13 which should be selected randomly, it gives an error. I suspect that you need to make changes to the table, or use the code, but I have not found anything yet

That is because you have 9 rows in your condition file and you selected row number 13 which does not exist. The error message tells you that the numbers that you selected (i.e., 13) is out of range of your condition file rows (1:9).

Moreover, I think you do not need dollar signs for the nRep and random seed tabs.

Thanks so much for the tip. And once again I apologize for my English. I still cannot solve this problem. Now there are 18 values ​​in my file, thanks it helped
I created an order that consists of a fixation cross, and the track is ready, and I created three trail loops (one trail with 5 other 9 and 13). And then there were problems.

  1. When starting, it says one digit, and then there is a cross and the track is ready, then the second digit and again the track is ready and the cross. But it is necessary that he first pronounce 5 or 9 or 13 digits, and only then the cross and the redi path.
  2. Secondly, how can I make sure that trails from 5,9,13 are chosen randomly, but only 4 times
    I really hope for your help

Hi Dauren,

I think your explanations is not complete and I could not get what you want. You need to explain more clearly your goals.

  1. What do you want to do?Do you want to present some audio or digits? You selected audios from the condition file, but how did not say anything about digits. Where are they coming from?

  2. Why do you have nested loops? Do you have a special design in your mind? Why do not you use three single trials, each with a loop? You need to explain what you are trying to achieve with these nested loops.

  3. What do you mean that “it did not worked”? What was the error message?

  4. In your explanations, make difference between trial, routine, and loop. Every component (or screen) in your experiment (e.g., fixation or trial1_5 in your experiment) is a routine. Some routines contain trials (for example, your trial routine has several trials which is selected from your condition file). And you can loop over a routine (you have 3 loops here).

Thanks for the information, I will try to describe my experiment in more detail. And thank you very much for taking the time for me
I want to present audio tracks that contain numbers - only nine audio tracks, therefore 9 digits. There is a separate audio track that contains the word “Ready”, it sounds before the start of the routine.
The experimental session consists of 3 routines. The first consists of a fixation cross and the word “Ready.” The second routine contains tracks with numbers (with 5 or 9 or 13 digits). There are three loops, because in the experiment there are three blocks of tasks - each with 4 presentations where the presentation will be randomly selected from 9 audio tracks - 5 times, 9 times or 13 times (For example, there may be 5 digits, 9 digits, 5 digits, 13 digits). And all such magnifiers. After each presentation in the loop of 4, the word “Ready” will sound again. Between loops (they are also blocks in the experiment), a break of 2 minutes will be made. I said that the experimental session consists of 3 routines, the third routine contains the word “End” which signals the end of the experiment.

There are three loops, because in the experiment there are three blocks of tasks

So, that should be easy. You can create three blocks with nested loops. However, you need to know how those loops work. Basically, it starts with the most inner one and then goes to the outer one. Depending on the number of the iterations, it loops over the inner one again. So, I suggest to take a screenshot from each loop descriptions to find the problem. I am not sure if you have specified any row numbers or file for the outer loops or not.

Take a look at this post to get an idea:
https://www.psychopy.org/builder/blocksCounterbalance.html

You also need to specify the problem and the exact error message. If you still get the out of range error, that is because your condition file has lower values than that you specified.

Finally, the description of the study is not consistent with the screenshots. Are you still using the same routine? For example, I cannot see any End routine here.

Hi. I decided to finish my coursework. Thank you very much for the link, I have a problem with creating create three blocks with nested loops. I did everything as it should in the link that you suggested. In the outer loop I pointed out the file chooseBlocks.xlsx variable called condsFile which contains 5.xlsx 9xlsx and 13 xlsx (file name reflects the number of digits that are there). And in the inner loop I installed $condsFile. In the lis_block, I set the variable sounds because it is in the files 5.xlsx 9xlsx and 13 xlsx. I got an error: digit = sound.Sounds(sounds, secs= -1, stereo=True) NameError: name 'sounds' is not defined I imagine that this is due to the fact that such a variable is not pointed directly, since it is in files 5.xlsx 9xlsx and 13 xlsx. but if you specify the "digit" in the stimulus, the variable condsFile then an error is generated
self.nReps = int (nReps)
TypeError: int () argument must be a string, a bytes-like object or a number, not ‘NoneType’
I have said a lot, I will attach screenshots of what I described, and the design of the experiment to make it more convenient. So far I decided to make the first block from design. I apologize in advance for my English.