The following button behavior plays sound member ("member(1)") with random start & end time when clicked.
The strategy is:
1. Determine the duration of the sound
2. Set the random start time. I did "random(soundDuration - 1000)" so that at least the start time will be 1 second before the end.
3. Set the random end time.
4. Play the sound using start/end time just set.
--
on mouseUp me
soundMember = member(1)
soundDuration = soundMember.duration
put "soundDuration:" && soundDuration
startCue = random(soundDuration - 1000)
endCue = startCue + random(soundDuration - startCue)
put "startCue:" && startCue
put "endCue:" && endCue
sound(1).play([#member:soundMember, #startTime:startCue, #endTime:endCue])
end mouseUp
--
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.