PennController for IBEX › Forums › Support › Audio playing twice
- This topic has 4 replies, 2 voices, and was last updated 2 years, 6 months ago by
stradee.
-
AuthorPosts
-
April 27, 2023 at 12:43 am #10484
stradeeParticipantHi, Jeremy.
In my current script, especially in ‘practice’ session, I made participants click the play button only once, and then audio bar disappears.
I want them to click the play button up to twice if they want to listen more.
How can I modify my script?Here is my link >>
https://farm.pcibex.net/r/nGASfr/Thanks!
April 27, 2023 at 3:47 am #10486
JeremyKeymasterHi,
After the
waitcommand on the Audio element, instead of removing it immediately, tell the script to wait a second time before removing it. Now, you don’t want that secondwaitto block the rest of the script (ie. you want the TextInput element to appear immediately after the first playback, even if the audio isn’t played back a second time) so you need to run those instructions in parallel, in thecallbackcommand of a Timer element for example:newAudio("audio", row.audio) .center() .print() .wait() , newTimer(10).callback( getAudio("audio").wait().remove() ).start()Jeremy
April 29, 2023 at 3:18 am #10493
stradeeParticipantHi, Jeremy.
I modified the script as you mentioned, but it didn’t work well as I expected.I want participants to listen to the target audio file once or twice (as they want to listen one more)
So, after they listen twice, the audio play bar must disappear so that they cannot listen any more.How can I modify the script?
Thanks for your help!>>
Template( “practice2.csv” , row =>
newTrial(“practice”,
newTimer(“break”, 1000)
.start()
.wait()
,
newAudio(“audio”, row.audio)
.center()
.print()
.wait()
,
newTimer(10)
.callback(getAudio(“audio”).wait().remove()).start
,
//getAudio(“audio”)
// .remove()
//,
newTextInput(“answer”)
.size(400, 50)
.cssContainer({“margin”:”2em”})
.center()
.log()
.print()
,
newButton(“next”, “다음”)
.center()
.cssContainer({“margin”:”1em”})
.print()
.wait(getTextInput(“answer”).test.text(/[ㄱ-ㅎㅏ-ㅣ가-힣]+/))
.remove()// .log(///)
)
);April 29, 2023 at 3:43 am #10494
JeremyKeymasterHi,
You’re missing the parentheses()onstartJeremy
April 30, 2023 at 2:09 am #10495
stradeeParticipantJeremy, it works well!! I didn’t notice just a simple mistake.
Really thank you!! -
AuthorPosts
- You must be logged in to reply to this topic.