Hi there,
I'm writing a program that plays an audioclip, then waits for 2 seconds, then plays another audioclip, waits another 2 seconds, then plays a final audioclip. The audioclips themselves vary from 1.5 to around 3ish seconds. However, at the moment the code looks something like this:
play audioclip clip1.wav
wait 2 seconds
play audioclip clip2.wav
wait 2 seconds
play audioclip clip3.wav
The problem is that the wait functions execute from the beginning of the audioclip, rather than waiting till the audioclip is finished. So at best the audioclips play end to end, and sometimes a clip is stopped so a new one can start. How can I do what I actually want to do? I have a feeling the playstopped message comes into it somewhere but my understanding of the code isn't good enough yet to figure out how!
Any help would be greatly appreciated.
Waiting while sound is playing
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Waiting while sound is playing
Hi gjn1w07,
the magic word is "sound" and "done", OK the magic wordS ARE "sound" and "done"
...
## ac = abbreviation for audioclip
play ac "clip1.wav"
wait until the sound is "done"
play ac "clip2.wav"
wait until the sound is "done"
play ac "clip3.wav"
...
Hint: Get used to put QUOTES around names! Remember Murphys law
Best from germany
Klaus
the magic word is "sound" and "done", OK the magic wordS ARE "sound" and "done"

...
## ac = abbreviation for audioclip
play ac "clip1.wav"
wait until the sound is "done"
play ac "clip2.wav"
wait until the sound is "done"
play ac "clip3.wav"
...
Hint: Get used to put QUOTES around names! Remember Murphys law

Best from germany
Klaus
Re: Waiting while sound is playing
Awesome - that's exactly what I needed. Thank you so much. I was starting to get into overly complicated ways to do it, like having a player object to put the sounds into and then put in a wait command based on the duration of the player.
Greg
Greg