|
Kate Bunnyhug
Registered User
Join date: 30 Jul 2005
Posts: 2
|
08-28-2005 07:30
I made an Eggmobile and I want it to play the music that plays when Eggman appears in Sonic 2 when I drive it. I got the sound files ya. is 4 of them.
So.. I think what I'm looking for is something that will loop the 4 sounds so that all the 4 sounds wont play all at once aand.. make it play when I get into the Eggmobile.
And incase its somewhat important to know, sound file 1, 2 and 3 is 10 seconds long and sound file 4 is 6.39 seconds long. So.. Thanks to anyone who helps!
|
|
Foolish Frost
Grand Technomancer
Join date: 7 Mar 2005
Posts: 1,433
|
08-28-2005 08:33
Ok. first: Let me advise you of some things your going to have to do.\
Take the original sound file. Cut it into 9.0 to 9.7 (not 10) second chunks. Try and only break the sound at the lowest points available. That will probably be between beats, so when you edit the files, wtch for when the waveform narrows the most. If you have to cut at 5.3 seconds to do this, then do so! It's worth it.
Add a small amount of silence (0.1 seconds) onto the beginning of the files. This will be used to prevent a known bug with sounds that cause it to sometimes be heard at 1000% volume miles away in the first instant it's started to play.
Figure out the time length of each file, MINUS the 0.1 seconds of silence.
Have a timer setup to play the sounds in sequence, using the times up above.
Now, that's the method. Anyone want to take a shot at the code?
|
|
Kate Bunnyhug
Registered User
Join date: 30 Jul 2005
Posts: 2
|
08-29-2005 12:08
yeah, that would be nice
|
|
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
08-30-2005 04:10
I've not been in world, but with some ammendments to the first three lines - for names, lengths etc. - this should work. list soundNames=["sound1", "sound2", "sound3", "sound4"]; //replace these with your actual sound names. list soundLengths=[10.0, 10.0, 10.0, 8.8]; //replace these with the actual values. float volume=0.5; //Set this to your required volume. integer i;
default { state_entry() { llSetTimerEvent(0.1); //Play everything from the timer event. } on_rez(integer param) { i=0; //Make sure we start the sound from the first one llSetTimerEvent(0.1); //Play the sounds } timer() { llPlaySound(llList2String(soundNames, i), volume); //Play the current sound llSetTimerEvent(llList2Float(soundLengths, i)); //Make sure we're ready to start the next sound if(i>2) //It must be 3, so 0-3 for our 4 sounds, we're at the end of the list. { i=0; //so start again } else { i++; //else add one so we play the next sound } llPreloadSound(llList2String(soundNames, i); //preload the sound so it plays quickly. } }
|
|
Omei Turnbull
Registered User
Join date: 19 Jun 2005
Posts: 577
|
09-03-2005 11:32
Eloise,
I've only read the documentation, not actually tried playing sounds. But wouldn't you want to add a call to llSetSoundQueueing(TRUE) to keep a new segment from cutting off a playing one?
|
|
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
09-03-2005 14:25
The timers should stop that happening. I've not actually tried the script in-world as it says, but I've seen it done this way quite satifactorily.
If you get sounds cutting each other up then yes, setting the sound queuing ought to be a fix to it.
|
|
Jadon Christensen
Registered User
Join date: 24 Dec 2005
Posts: 32
|
03-31-2006 18:49
I was trying to make this work with 2 sounds. 27, 51 ERROR : syntax error list soundNames=["cantina-aaa", "cantina-bbb"]; //replace these with your actual sound names. list soundLengths=[7.0, 7.2]; //replace these with the actual values. float volume=1.0; //Set this to your required volume. integer i;
default { state_entry() { llSetTimerEvent(0.1); //Play everything from the timer event. } on_rez(integer param) { i=0; //Make sure we start the sound from the first one llSetTimerEvent(0.1); //Play the sounds } timer() { llPlaySound(llList2String(soundNames, i), volume); //Play the current sound llSetTimerEvent(llList2Float(soundLengths, i)); //Make sure we're ready to start the next sound if(i>2) //It must be 3, so 0-3 for our 4 sounds, we're at the end of the list. { i=0; //so start again } else { i++; //else add one so we play the next sound } llPreloadSound(llList2String(soundNames, i); //preload the sound so it plays quickly. } }
|
|
Leonard Churchill
Just a Horse
Join date: 19 Oct 2005
Posts: 59
|
03-31-2006 20:33
Parenthesis on the last statement unbalanced.
|