PennController for IBEX › Forums › Support › Play sound after correct response › Reply To: Play sound after correct response
September 7, 2020 at 6:53 pm
#6045
Keymaster
Hi,
This worked for me—audio file’s just an example, and I hard-coded ArrowLeft as the correct answer, but you should be able to replace it with row.Correct_answer:
newKey("pressOnArrow", "ArrowLeft", "ArrowRight")
.log("all")
.callback(
getTimer("exposure").stop(),
getTimer("timeout").stop()
)
,
newTimer("exposure", 300).start().wait()
,
getText("num").remove()
,
getKey("pressOnArrow").test.pressed()
.failure( newTimer("timeout", 5000).start().log().wait() )
,
getKey("pressOnArrow")
.disable()
.test.pressed( "ArrowLeft" )
.success( newAudio("https://upload.wikimedia.org/wikipedia/commons/3/35/Bongo_Agudo.ogg").play().wait() )
Let me know whether that helped fix the problem
Jeremy