Reply To: Audio file naming

PennController for IBEX Forums Support Audio file naming Reply To: Audio file naming

#9717
Jeremy
Keymaster

Hi,

This is because PennController elements are created immediately, but PennController commands are delayed: getVar() does not return a string, it returns an object that some PennController commands will use to retrieve its value

What you can do is generate a unique ID for each participant and use it both in the Audio elements’ names and in a log command on the newTrial()s so you can cross-reference things from the results file, for instance:

uniqueID = [1,2,3,4].map(v=>Math.floor((1+Math.random())*0x10000).toString(16).substring(1)).join('-');

Template( "exp5.csv" , row => 
  newTrial( "exp5Task" ,
    // ...
    newMediaRecorder(uniqueID+"_"+getVar("ID"),"audio").record()
    // ...
  )
  .log("uniqueID", uniqueID)
)

Jeremy