Jump to content

Playing sounds longer than 10 seconds...


Domitan Redenblack
 Share

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

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

Recommended Posts

you know your not dumb, so stop saying that, as it could show your lack of confidence, well done by the way on the pages i have seen and your work has been noted........... You are doing a grand job, with a very difficult and complex medium.. Well done and thank you on the behalf of all the users whom have not thanked you.... I am dyslexic and calclexic so find this stuff rearly hard, but I allso have a masters in sociology... we can get round our problems eventualy with all the aids around to help us now.... But I do wish that scripters would place instructions and what the elinets are for ""in green""  like ""this turns the car left"" or ""this banks the plane"".. scripters should remember that not all people are on there level, and that one must cator for the lowest denominator, not the highest, So the clear message here is, dunb down scriptin so any one can see its idiot proof.... Thanks again  PS and Oh... please rememebr that all age groups are in second life some are 62 and older.. Im 62 and trying to keep up with you guys.... 

Link to comment
Share on other sites

That's good advice.  Scripters are like everyone else. We tend to focus on the parts of projects that we find most challenging and we lose interest when those parts are done. Personally, I document out of self defence, not because I love it.  I found years ago that I can get into serious trouble if I don't pepper my scripts with comments to remind myself of what I did. Six months after I finish a script, I've forgotten all the fiddly details entirely. [i don't remember having that problem when I was 62, but it's been a while. Maybe I have always been absent-minded.]   I also learned somewhere that writing careful instructions for the end user will mean that I get fewer panicky trouble calls later.

Steve Jobs used to feel proud of creating "intuitive" user interfaces, but there's no such thing. Things work well when they are only as complicated as they need to be, and when they are easy to make familiar.  Interfaces become intuitive only because we have figured them out well enough that we don't need to pay attention to them any more. [Remember learning to tie your shoes?]  I doubt that there is such a thing as "idiot-proof" documentation either.  I don't think it's wise to underestimate the idiots of the world, but  I like to think that people who use my creations are fairly intelligent.  I don't believe in robbing people of the incentive to discover some things on their own.There's got to be a balance between providing a thick instruction manual and offering nothing at all.  I get very few trouble calls, so I think I usually I hit the proper balance in my documentation. Or maybe my clients are a lot smarter than I thought.

BTW, I never said I was dumb -- well, almost never.  I just said I wasn't as dumb as I look.

Link to comment
Share on other sites


Rolig Loon wrote:

I just said I wasn't as dumb as I look.

Which is also not the same as saying you look dumb... just dumber than you are.

There's a compliment in there if you dig hard enough.

;-).

ETA: How often have you had the experience of looking at your old code and wondering if it had been written by an idiot. Then, upon further inspection, you discover that it was actually written by someone very clever, but is currently being read by an idiot.

It's all relative.

Link to comment
Share on other sites

Rolig's notes/comments in scripts are also there because she makes these incredibly complex, magical scripts for script test dummies like me, for whom scripts might as well be written in Arabic. And if I don't have trouble using them, neither do any of my customers, yay!

Link to comment
Share on other sites

  • 2 years later...
On 10/25/2011 at 8:30 PM, Void Singer said:

this should play as many chained sounds as memory allows...


float vFltSndLen = 9.0; //-- length of each sound file in sequence (last one can be any length)list  vLstSndNms = ["a", "b", "c", "d"]; //-- names of all the sound files in orderinteger vIdxSndNum; //-- used to track which sound to playdefault{	state_entry(){		vFltSndLen *= 2.0; //-- double length now so the timer function is simpler		llSetSoundQueueing( TRUE );	}		touch_end( integer vIntTch ){		if (vIdxSndNum){			llSay( 0, "wait for it to finish" );		}else{			vIdxSnd = ([] != vLstSndNms); //-- same as (-llGetlistLength( vLstSndNms ))			llPlaySound( llList2String( vLstSndNms, vIdxSnd ), 1.0 );			llResetTime();			llSetTimerEvent( 1.0 ); //-- pad the start time for the next sound		}	}		timer(){		if (++vIdxSndNum){			llPlaySound( llList2String( vLstSndNms, vIdxSnd ), 1.0 );			llSetTimerEvent( vFltSndLen - (llGetAndResetTime() - vFltSndLen) );			//-- time will never be less than actual sound length thanks to time dilation //-- this ensures that we continually adjust to hit the realtime mark loading just after pad time //-- and shouldn't fail unless the average dilation was below ~0.6		}else{			llSetTimerEvent( 0.0 );		}	}}

 

 

Well, I've learned that when Void speaks, the thing to to is listen.  I got this script to work, after fixing a couple of typos.  I'm impressed by the adjustments for time dilation.  

I am not quite following the rationale for doubling the vFltSndLen.  I got long sound gaps with 2*vFltSndLen, and stepped back to 1*vFltSndLen as shown below.  Can someone help me understand Void's logic?  I have noticed that she doesn't post much anymore.  

 

float vFltSndLen = 9.733;

//-- length of each sound file in sequence (last one can be any length).  

// -- My sound happens to be 29.2 seconds, so I sliced it into 3 parts in Audacity

// of 9.733 seconds, sacrificing the last 0.001 of trail-off music.  
 

list  vLstSndNms = ["A", "B", "C"]; //-- names of all the sound files in order
integer vIdxSndNum =0; //-- used to track which sound to play

default
{    
    state_entry()
    {        
        llVolumeDetect( TRUE );
        vFltSndLen *= 1.0;

// Void says "-- double length now so the timer function is simpler "  this it the part I don't understand.  "vFltSndLen *= 1.0" works better for me.
        llSetSoundQueueing( TRUE );    
    }
    
    collision_end( integer num_detected ) // I am triggering with collision_end not touch.  Use touch if you prefer.
    {        
        if (vIdxSndNum)
        {            
//            llSay( 0, "wait for it to finish" );        
        }
        else
        {            
            vIdxSndNum = (-llGetListLength( vLstSndNms ));   // I had never used negative indexes before, but I get it and I like it!
            llPlaySound( llList2String( vLstSndNms, vIdxSndNum ), 1.0 );            
            llResetTime();            
            llSetTimerEvent( 1.0 ); //-- pad the start time for the next sound        
        }    
    }        
    
    timer()
    {        
        if (++vIdxSndNum)
        {            
            llPlaySound( llList2String( vLstSndNms, vIdxSndNum ), 1.0 );            
            llSetTimerEvent( vFltSndLen - (llGetAndResetTime() - vFltSndLen) );            
            //-- time will never be less than actual sound length thanks to time dilation 
            //-- this ensures that we continually adjust to hit the realtime mark loading just after pad time 
            //-- and shouldn't fail unless the average dilation was below ~0.6        
        }
        else
        {            
            llSetTimerEvent( 0.0 );        
        }    
    }
}

 

Edited by Erwin Solo
typo fix: "ist" --> "list"
Link to comment
Share on other sites

This is what worked well for me. Your mileage may vary.

// Erwin Solo 2018-09-28
// Based on Void Singer 2011-10-25 at <this url>

float vFltSndLen = 8.5; //-- length of each sound file in sequence (last one can be any length, but 10 seconds or less of course)
list  vLstSndNms = ["A", "B", "C"]; //-- names of all the sound files in order
integer vIdxSndNum =0; //-- used to track which sound to play

default
{    
    state_entry()
    {        
        llVolumeDetect( TRUE ); // sets object up for collision detect
        llSetSoundQueueing( TRUE );
    }

    on_rez(integer start_param)
    {
        // Restarts the script every time the object is rezzed
        llResetScript(); 
    }

    changed(integer change)
    {
        if ( change & CHANGED_OWNER | CHANGED_REGION_START ) 
        {
          llResetScript();
        }

    }

    collision_start ( integer num_detected ) 
    // -- Object used at my landing point.  People land on it. 
    {
        if (!vIdxSndNum)
        {            
            vIdxSndNum = (-llGetListLength( vLstSndNms ));
            llPreloadSound (llList2String( vLstSndNms, vIdxSndNum));  
            //-- Preload first sound.  Causes one second delay
            llPlaySound( llList2String( vLstSndNms, vIdxSndNum ), 1.0 );
            llResetTime();
            llSetTimerEvent( 1.0 ); //-- pad the start time for the next sound
        }    
    }

    
    collision_end( integer num_detected ) 
    // -- Object used at my landing point.  
    // -- People walk away from it and sound plays again, 
    // -- or continues, depending on how quickly they move.
    {        
        if (!vIdxSndNum)
        {            
            vIdxSndNum = (-llGetListLength( vLstSndNms ));            
            llPlaySound( llList2String( vLstSndNms, vIdxSndNum ), 1.0 );
            llResetTime();            
            llSetTimerEvent( 1.0 ); //-- pad the start time for the next sound        
        }    
    }        
    
    timer()
    {        
        if (++vIdxSndNum)
        {            
            llPlaySound( llList2String( vLstSndNms, vIdxSndNum ), 1.0 );            
            llSetTimerEvent( 0.9* (vFltSndLen - (llGetAndResetTime() - vFltSndLen) ) );
            //-- time will never be less than 90% of actual sound length thanks to time dilation 
            //-- this ensures that we continually adjust to hit the realtime mark to load for 
            //-- sound queueing via llSetSoundQueueing( TRUE );
        }
        else
        {            
            llSetTimerEvent( 0.0 );        
        }    
    }
}
 

 

Edited by Erwin Solo
added on_rez and changed events
Link to comment
Share on other sites

On 9/28/2018 at 1:24 PM, Erwin Solo said:

Well, I've learned that when Void speaks, the thing to to is listen.

I dunno.. that script seems to have at least one major bug as far as I can tell. (On mobile so I can't test yet.)

On 9/28/2018 at 1:24 PM, Erwin Solo said:

vIdxSnd = ([] != vLstSndNms); //-- same as (-llGetlistLength( vLstSndNms ))

This is 100% wrong.

If the list has 3 items, "([] != Lst)" is 1, and" -llGetListLength(Lst)" is -3.

It NEEDS to be the llGetListLength version for the script to work, because the timer increments the value before checking if it's non-zero.

On 9/28/2018 at 1:24 PM, Erwin Solo said:

llSetTimerEvent( vFltSndLen - (llGetAndResetTime() - vFltSndLen) );

Since the length was doubled, it's "18 - (time since reset - 18)" I'm not sure how that's supposed to adjust to time dilation as first it's 18-17 so the timer triggers in one second again.. where GetTime will be around one second again.

Edited by Wulfie Reanimator
Link to comment
Share on other sites

  • 2 weeks later...
On 9/29/2018 at 4:16 AM, Wulfie Reanimator said:

I dunno.. that script seems to have at least one major bug as far as I can tell. (On mobile so I can't test yet.)

...

Yeah, it had a couple of errors that I easily worked through.  Void apparently didn't test it. 

It also had some ideas that I'd never seen before--like adjusting for time dilation. 

I really miss Void being around.  I miss having someone around to bring up non-obvious things.  

The whole backstory of why is documented elsewhere in the forums; no need to repeat it.  

 

Link to comment
Share on other sites

  • 2 years later...
8 hours ago, meady212 said:

I am interested if you can turn this into a walker? to make lets say 20 seconds instead of 10 seconds

You are answering an eleven years old thread, where someone answered two years ago...

I am not sure, it is clear, what you want. The is no limitation except memory of the song list in @Void Singer's original code. The limitation of a sound file is just below 10 seconds (9.7 if I remember correct), in order to play longer a sound longer than 10 seconds, you must split the original sound file into elements of max length of just below 10 seconds and do as Void showed.

 

  • Like 1
Link to comment
Share on other sites

On 12/14/2020 at 3:09 AM, Rachel1206 said:

You are answering an eleven years old thread, where someone answered two years ago...

I am not sure, it is clear, what you want. The is no limitation except memory of the song list in @Void Singer's original code. The limitation of a sound file is just below 10 seconds (9.7 if I remember correct), in order to play longer a sound longer than 10 seconds, you must split the original sound file into elements of max length of just below 10 seconds and do as Void showed.

 

I know this but with the script it doesn't work is what i am saying

Link to comment
Share on other sites

15 hours ago, meady212 said:

it doesn't work

What doesn't work?  If you are trying to play sound clips that are longer than 10 seconds, no, they will not work.  If that's not what you meant, what "isn't working" about Void's script? Or did you mean that something isn't working in a script that you wrote?

Link to comment
Share on other sites

22 hours ago, Rolig Loon said:

What doesn't work?  If you are trying to play sound clips that are longer than 10 seconds, no, they will not work.  If that's not what you meant, what "isn't working" about Void's script? Or did you mean that something isn't working in a script that you wrote?

I have cut the song under 10 seconds but when i put it in a box and wear it it only plays the first 9 seconds of the first clip but wont go to the next clip if that makes sense

Link to comment
Share on other sites

Check to be sure that you have listed your sound files correctly in vLstSndNms. Then consider adding a couple of diagnostic llOwnerSay messages in your collision_start and collision_end events and in the timer event, so see whether vIdxSndNum really advances properly once you're in the timer event.  That's where the second sound clip should be playing.  I suspect that you copied something incorrectly.

  • Like 1
Link to comment
Share on other sites

On 12/23/2020 at 5:10 AM, Rolig Loon said:

Check to be sure that you have listed your sound files correctly in vLstSndNms. Then consider adding a couple of diagnostic llOwnerSay messages in your collision_start and collision_end events and in the timer event, so see whether vIdxSndNum really advances properly once you're in the timer event.  That's where the second sound clip should be playing.  I suspect that you copied something incorrectly.

ok I will give that a go

Link to comment
Share on other sites

  • 1 year later...
5 hours ago, Lita Jannings said:

I wish Linden Labs would allow for longer sound clips, like maybe 30 seconds instead of 10 seconds.

 

They pitched this for over 2 years, even adding a viewer check to block anything over 30 seconds from being uploaded then when it comes time for release it is absent from the feature set. Then when I bring it up in the Web meeting, they pass the buck to the Server team, who doesn't sign off on anything for Premium Plus.

 

Link to comment
Share on other sites

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

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
 Share

×
×
  • Create New...