PennController for IBEX › Forums › Support › recording audio production › Reply To: recording audio production
June 14, 2022 at 4:18 pm
#8234
Participant
Hi, One question on to best use .callback
I have implemented this:
newButton("trigger", "RECORD")
.log()
.css("font-size", 20)
.css("font-family", "Verdana", "sans-serif")
.callback(
//clear()
//,
getButton("trigger")
.css("font-size", 20)
.css("font-family", "Verdana", "sans-serif")
.remove() // Print the button now: clicking it will end the trial (=validate the wait command)
,
getButton("CONTINUE")
.css("font-size", 20)
.css("font-family", "Verdana", "sans-serif")
.remove() // Print the button now: clicking it will end the trial (=validate the wait command)
,
newMediaRecorder(variable_practice.Output_audio+"_"+id_participant, "audio")
.log()
.center()
.record()
,
newText("spazio", " ")
.center()
.print()
,
newButton("STOP")
.css("font-size", 20)
.css("font-family", "Verdana", "sans-serif")
.print()
.wait()
.remove()
,
getMediaRecorder(variable_practice.Output_audio+"_"+id_participant)
.stop()
.log()
,
newText("empty"," ")
.center()
.print()
,
newButton("PLAY")
.css("font-size", 20)
.css("font-family", "Verdana", "sans-serif")
.log()
.print()
.wait()
.remove()
,
getMediaRecorder(variable_practice.Output_audio+"_"+id_participant)
.play()
.wait("playback")
.log()
,
newText("spazio2", " ")
.center()
.print()
,
newText("Exit1","If you wish to record again, press RECORD")
.css("font-size", 20)
.css("font-family", "Verdana", "sans-serif")
,
newText("Exit2","If the audio seems clear and of good quality, press CONTINUE")
.css("font-size", 20)
.css("font-family", "Verdana", "sans-serif")
,
getButton("trigger")
.print() // Clicking this will execute the callback sequence again
//.wait()
//.remove()
,
getButton("CONTINUE")
.css("font-size", 20)
.css("font-family", "Verdana", "sans-serif")
.print() // Print the button now: clicking it will end the trial (=validate the wait command)
)
.print()
.wait()
.log()
.remove()
,
// This button will only be printed at the end of a test,
// So the script won't have a chance to move past the wait command until then
newButton("CONTINUE")
.css("font-size", 20)
.css("font-family", "Verdana", "sans-serif")
.css("margin-top","1em")
.wait()
.log()
,
I would like actually to save two separate audio files if the participant click CALLBACKS.
Can i index the mediarecording like in a for cycle?
Like something everytime the participants hits the trigger, a variable + 1 (i + 1), the name of the audio file + “id_participant_” + i
So that if the participant records 10 times the same thing I save 10 version of the file, and I don’t overwrite the same variable?
Thanks!
HPI