Playing audio a specific number of times

mlapl1
mlapl1 Community Member Posts: 349 ☆ Roadie ☆
Hello

I would like to play an audio file a certain number of times, let's say 3, after a learner has clicked an object.

I can see how to loop it using the loop command but of course, it does not stop automatically.

However, although I have tried to play with variables (incrementing them etc. I cannot seem to be able to get the file to play more than once). Basically, I need to set a loop inside a mouse click so that if the condition is not met, the file is played AND the counting variable is incremented.

Is there a simple way of doing this (ie. not requiring javascript)? It somehow feels that there should be but I cannot get my head around the logic of it.

Thanks

 

 

 

Comments

  • ssneg
    ssneg Community Member Posts: 1,466 ☆ Roadie ☆
    A super-easy way would be to use Audacity or any other sound editor and just make a 3-loop soundclip ;)

    In Lectora, I would do this:
    On Button > on Click > Play Audiofile.mp3
    On Audiofile > on Done > Add +1 to variable _Counter
    On Audiofile > on Done > Play Audiofile.mp3 > IF _Counter < 3

    Also, I hear that "on done" doesn't fire in some situations, so test it. If it doesn't work, add a timeline event to the audio 0.5 sec before it ends, used in the same way as "on done" above.
  • mlapl1
    mlapl1 Community Member Posts: 349 ☆ Roadie ☆
    Thanks Sergey (again :) ). Audacity is not an option as I need to be able to change things either programmatically or manually according to circumstances. I will check out the "done" event.

    Cheers
  • mlapl1
    mlapl1 Community Member Posts: 349 ☆ Roadie ☆
    Hello... just following up.

    Sergey is right that OnDone does not always work. The way I fixed it was to modify the recording slightly and resave it as MP3 (actually using the Lectora editor) and that seemed to do the trick (at least this time). Hope that helps others.