Can anyone explain to me how I can get a sound to play repeatedly at the same time? If I try to play a 3-second sound clip 10 times in 5 seconds, it only plays once the first time, and then once again 3 seconds later…I can’t seem to get it to play multiple times even as it’s already being played.
- emilfalcon asked 12 years ago
[quote:1a45ilyc]play a 3-second sound clip 10 times in 5 seconds[/quote:1a45ilyc]
Is your life always this complicated?
Translation 1: you want to stretch a 3-sec sound so that it lasts 5 secs, and then repeat the process 10 times.
Translation 2: you want to play the first 0. 5 secs of a 3-sec sound, and then repeat the process 10 times.
Translation 3: you want to start 10 instances of a 3-sec sound, but force the sound(s) to keep playing until five seconds has passed since the first instance began.
Well, let me stop there and simply suggest that you initialize x-number of sound channels (ten?) and then write code that will execute channels 1 through x and stop channels 1 though x in the manner you intend. Channels (software and hardware) are defined in the FMOD initialization statement, and FMOD will return a unique LONG for each channel that is created after initialization.
Ok… as Brett explained, you’ll need to open the sound as four different samples–rather than streams. Once you’ve got the samples loaded and ready, you can then cascade the playback. Whether or not you can do this within 100 msecs will depend on the local system.
I’m curious, though: What kind of effect are you trying to produce by cascading the same sound file? Would it not be easier to just design a single media file (say, in Cool Edit) that sounds the same? There is then no need to worry about timing issues, because the timing would be represented in the media itself–it would always be perfect and constant.
Please login first to submit.