Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

random start and end time 1

Status
Not open for further replies.

derezzz

Technical User
Joined
May 12, 2004
Messages
1
Location
US
Hey, can anyone help me with lingo on random start and endtime for sounds that are shockwave files?
 
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
--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top