Skip to content
Discussion options

You must be logged in to vote

Hi @alberteseeberg,

One approach would be to create an array of the 90 sound files and shuffle the order:

const sounds = ['sound1.mp3', 'sound2.mp3', ... ];
const randomized_sounds = jsPsych.randomization.shuffle(sounds);

Then you can take the first set of randomized_sounds to create the first block.

const block_1 = {
  timeline: []
}

// here I'm assuming 23 trials in the first block
for(let i=0; i<23; i++){
  block_1.timeline.push({
    type: jsPsychAudioKeyboardResponse,
    stimulus: randomized_sounds[i]
  });
}

... and so on for the other blocks.

Then you can add block_1, block_2, etc. to your main timeline.

There are other ways you could do this as well, so feel free to share more o…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@alberteseeberg
Comment options

Answer selected by alberteseeberg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants