Jump to content

Can someone help get this particular walker to fade out sound rather than just llStopSound()?


You are about to reply to a thread that has been inactive for 265 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

// Play a sound whenever the owner is walking
integer   gWasWalking;             // TRUE when wearer is already walking
string    gSound = "Sleepwalk";    // name of soundfile in inventory
default
{
    state_entry()
    {
        // Start a timer to continuously check if the owner is walking
        llSetTimerEvent(0.25);
    }
    timer()
    {
        integer NowWalking = llGetAgentInfo(llGetOwner()) & AGENT_WALKING;
        if  (NowWalking != gWasWalking)        // walking has stopped or started
        {
            llStopSound();
            if (NowWalking)
                llLoopSound(gSound, 1.0);
        }
        gWasWalking = NowWalking;
    }
}

 

Link to post
Share on other sites

You cannot easy, as we do not have independent volume control in LSL. As the wiki states: "If a second call to loop the same sound at a different volume is made from within the same script NO volume change is made. llStopSound set just previous to the second call for a new volume allows the volume change with no discernible pause."

One way to handle it, is using !NowWalking and add a control variable to handle the timer events walking with max volume or walking with fading sound correct. Decrease volume with 10% or 25% (so either 10 or 4 times less sound volume ), you need to stop the sound and the call llLoopSound with the new volume value until it is <=10%, then stop the sound and the timer.

Specify volume with a float value fVolume and use this to control, when sound fading and the timer has to stop. Remember to set fVolume= 1.0, when walking is resumed.

Using 0.250 ms looks a little like an overkill to me, are you walking sound only 250 ms long?

Edited by Rachel1206
  • Confused 1
Link to post
Share on other sites
1 hour ago, Rachel1206 said:

You cannot easy, as we do not have independent volume control in LSL. As the wiki states: "If a second call to loop the same sound at a different volume is made from within the same script NO volume change is made. llStopSound set just previous to the second call for a new volume allows the volume change with no discernible pause."

One way to handle it, is using !NowWalking and add a control variable to handle the timer events walking with max volume or walking with fading sound correct. Decrease volume with 10% or 25% (so either 10 or 4 times less sound volume ), you need to stop the sound and the call llLoopSound with the new volume value until it is <=10%, then stop the sound and the timer.

Specify volume with a float value fVolume and use this to control, when sound fading and the timer has to stop. Remember to set fVolume= 1.0, when walking is resumed.

Using 0.250 ms looks a little like an overkill to me, are you walking sound only 250 ms long?

My music player uses llAdjustSoundVolume for volume control. A "fade out" is still not very elegant. The simplest method would be to put that function into the timer event, and set the sound based on current velocity. Or you could just have a little loop to gradually lower the volume after movement stops.

Edited by Wulfie Reanimator
  • Like 1
Link to post
Share on other sites
8 hours ago, Wulfie Reanimator said:

My music player uses llAdjustSoundVolume for volume control. A "fade out" is still not very elegant. The simplest method would be to put that function into the timer event, and set the sound based on current velocity. Or you could just have a little loop to gradually lower the volume after movement stops.

Well more or less, what I described...

Anyway, I would suggest, when LL has finished their current cloud lifting, we suggest better media handling possibilities (basic is for example a media length in milliseconds) including being able to call a sound volume from a script.

Link to post
Share on other sites
18 minutes ago, Rachel1206 said:

Well more or less, what I described...

I was responding to your first paragraph.

18 minutes ago, Rachel1206 said:

better media handling possibilities (basic is for example a media length in milliseconds) including being able to call a sound volume from a script.

What do you mean by "media length in milliseconds" and "being able to call a sound volume"?

Edited by Wulfie Reanimator
Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 265 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...