Randomize objects before they are played

PennController for IBEX Forums Support Randomize objects before they are played

Tagged: 

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #11014
    Lucas
    Participant

    I’m doing a listening experiment where the participants listen to two audio files per trial and deem them as either “same” or “different”. I want to randomize the audio files such that they don’t always come in the same order. E.g., I want ‘tale’ to show up first only 50% of the time and ‘tæle’ first the other 50%. The way it’s coded now, ‘tale’ always comes first.

    Here’s a demo: https://farm.pcibex.net/r/GeGonq/

    and here’s my code:

    // Experimental trial 1
    newTrial(“experimental-trial”,
    newAudio(“tale”, “tale.m4a”)
    .play()
    .print()
    .center()
    .wait()
    ,
    newAudio(“tæle”, “tæle.m4a”)
    .play()
    .print()
    .center()
    .wait()
    ,
    getAudio(“tale”)
    .remove()
    ,
    getAudio(“tæle”)
    .remove()
    ,
    newCanvas(“empty-canvas”, 1, 40)
    .print()
    ,
    newText(“trial-instructions”, “<b> SAME (F) or DIFFERENT (J)</b>?”)
    .print()
    .center()
    ,
    newKey(“keypress”, “FJ”)
    .wait()
    )

    I’ve tried experimenting with .shuffle(), but I haven’t found a solution. Does anybody know how to do this?
    Thanks in advance.

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.