Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

in search of sound scripts

Aleksie Solvang
nani?
Join date: 21 Oct 2004
Posts: 113
08-25-2005 13:34
I'm currently looking for two scripts - if someone has them out there they'd be willing to sell/give that'd be great, otherwise.. if anyone here would be willing to create?

First Script: I have 7 sound files that I want to be played, swapped in and out to create a looped background noise.. and if there's any way - to do so randomly.. this should run on it's own without me having to click it after it's gone through all the sounds..

Second Script: this one sounds easy but I'm not a scripter - what do I know? :P - I just need a script that'll play one sound indefinitley.

thanks!
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
08-25-2005 13:37
I haven't thought much about the first script, but the second one is VERY easy.

llLoopSound( string sound, float volume )

is everything you need... Look for it on the wiki for more information.
Padraig Stygian
The thin mick
Join date: 15 Aug 2004
Posts: 111
08-25-2005 14:06
I believe the answer to your first question involves strided lists. Each stride would have two parts, the sound name, and the sound length. The script would then select a stride at random and play [sound] for [length] seconds.

I'm not entirely sure that's right, but it should work. I'd test the idea, but I'm at work.
_____________________
(You): Aww! My pants won't rez! Does this texture look okay on me?

Incidental Radio :: Because nothing is by design
Now featuring Torley-tastic technomusic!
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
08-25-2005 17:38
Or two lists, one of lengths the other of names rather than strided lists would work. You select a random integer in range 0<=#<list_length and pick the two elements out. Nice than the list randomiser.

for a really nice one you should also preload the next sound so they play smoothly.

I've not tried this, but something like:
CODE

list soundNames=["sound1", "sound2", "sound3"]; //etc. use your names here.
list soundLengths=[1.5, 8.9, 10.0];//get the lengths.
string sound;
float length;

setupSound()
{
integer i;
if(sound=="")
{
i==llFloor(llFrand(llGetListLength(soundNames)));
llPlaySound(llList2String(soundNames, i), 1.0);
llSetTimerEvent(llList2Float(soundLengths, i));
} else
{
llPlaySound(sound, 1.0);
llSetTimerEvent(length);
}
i=llFloor(llFrand(llGetListLength(soundNames)));
sound=llList2String(soundNames, i);
length=llList2Float(soundLengths, i);
llPreloadSound(sound);
}

default
{
state_entry()
{
setupSound();
}
timer()
{
setupSound();
}
}
Till Stirling
Crazy Inventor
Join date: 31 Jul 2004
Posts: 124
08-26-2005 00:11
Hi,

take a look at the Proximity Sounds Module that I am offering at my vendors and through the weblinks provided below! On request I also have a system available with multiple synchronized sound emitters if you need to cover a larger area.

IM me if you have any questions :)

Till
_____________________