Leo1452 Posted September 30, 2020 Posted September 30, 2020 // 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; } }
Rachel1206 Posted October 2, 2020 Posted October 2, 2020 (edited) 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 October 2, 2020 by Rachel1206 1
Necati Millet Posted October 2, 2020 Posted October 2, 2020 Make another sound using the same walking sound but with a fade out, then upload that one and use llTriggerSound or llPlaySound to play it once when it stops walking? 1
Wulfie Reanimator Posted October 2, 2020 Posted October 2, 2020 (edited) 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 October 2, 2020 by Wulfie Reanimator 1
Rachel1206 Posted October 2, 2020 Posted October 2, 2020 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.
Wulfie Reanimator Posted October 2, 2020 Posted October 2, 2020 (edited) 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 October 2, 2020 by Wulfie Reanimator
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now