I was trying to store a unique participantID in the audio filename as well.
I’m quite sure there is something wrong in the way I refer to the variable in the newMediaRecorder name. But I cannot figure out how to fix it. Could you help me out?
Here’s the trial with the function to define the variable
// Set unique participant ID to better recognize audios newTrial("speakID", newVar("speakID") .settings.global() .set(v =>[...Array(4)].reduce(a=>a+alphanum.charAt(Math.floor(Math.random()*alphanum.length)),'')) , newText("speakID", "") .settings.text(getVar("speakID")) .print(), newButton().print().wait() // to be deleted, just to double check that the code matches the audiofile ) .log("speakID", getVar("speakID"))
And here’s the way I named my newMediaRecorder element in following trials
If I don’t refer to the variable in the audiofile name, everything goes smoothly.
Thank you in advance!