Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Script Processing Speed and Efficiency

Mij Palmer
Registered User
Join date: 3 Jan 2007
Posts: 29
06-28-2007 02:19
Scenario:
I want an AV to sing and dance. I have a script that plays 30 sound files (each file is 9 secs long) in numerical order to provide the music and a “sing” animation with play animation script to have the AV sing into a microphone.

Questions:
I would like the song to play as smoothly as possible. I can put the play sounds script, the 30 sound files, the animation file, and the play animation script all in the microphone. Or, I can split them up and place the play sounds script and the 30 sound files in the microphone and the animation file and a play animation script in another object.

I have no idea of how SL processes files (parallel or series) or whether this even matters. Which of these approaches (or another I’m unaware of) is best for speed, processing efficiency, and smoothness of processing and why?
Thank you.
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
06-28-2007 02:41
From: Mij Palmer
I can put the play sounds script, the 30 sound files, the animation file, and the play animation script all in the microphone. Or, I can split them up and place the play sounds script and the 30 sound files in the microphone and the animation file and a play animation script in another object.
That part won't make much difference because once you trigger an animation, the script does nothing. Once the animation is downloaded to the clients, the sim does nothing either. The problem will be the sound files, and again the script processing is negligible; the delay is all in the download of the .wav to the clients.

There's a handy llPreloadSound() function that helps with that, but if the intent is to play the 30 sound files in one continuous stream, they're not all gonna fit in the client cache at the same time. So, if the sequence of sounds is known, one can try to feed the cache with preloaded sounds before it's time for them to play. (In-world "CDs" use this approach... but to be honest, I've never heard one more than a few samples long that didn't sometimes skip.)
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
06-28-2007 09:59
This has been discussed a lot in these Forums. Try some searching. Might also be worth searching a couple of the LSL Wikis.

SL is a highly distributed, asychronous, UDP based architecture. While this has many advantages, it also makes it very very hard to reliably synchronize things on the servers and many clients. For example, your script might say

play sound A
play sound B

but the messages to my client might arrive in any order, such as play B play A.

If you want good, long sound, you whould put it in the media stream, or maybe insert it into the Voice stream.