Audio playing twice

PennController for IBEX Forums Support Audio playing twice

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #10484
    stradee
    Participant

    Hi, 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!

    #10486
    Jeremy
    Keymaster

    Hi,

    After the wait command 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 second wait to 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 the callback command of a Timer element for example:

    newAudio("audio", row.audio)
        .center()
        .print()
        .wait()
    ,
    newTimer(10).callback( getAudio("audio").wait().remove() ).start()

    Jeremy

    #10493
    stradee
    Participant

    Hi, 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(///)
    )
    );

    #10494
    Jeremy
    Keymaster

    Hi,
    You’re missing the parentheses () on start

    Jeremy

    #10495
    stradee
    Participant

    Jeremy, it works well!! I didn’t notice just a simple mistake.
    Really thank you!!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.