Zindorf Yossarian
Master of Disaster
Join date: 9 Mar 2004
Posts: 160
|
04-07-2005 18:59
I am trying to create a music player script, but cannot get the preload to work very well. After the first few clips, there are gaps in the music, and then it fails to play entirely. Exactly what happens varies each time. I can only suppose that this is because of preloading being flaky. Can anyone help me out here, by giving me some tips and pointers for getting smooth music playback?
_____________________
Badass Ninja Penguin: Killing stuff it doesn't like since sometime in May 2004.
|
Frans Charming
You only need one Frans
Join date: 28 Jan 2005
Posts: 1,847
|
04-07-2005 20:29
Maybe you could check out "the band in a box" that you can get at the telehubs, that has a preloading object.
|
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
|
04-07-2005 20:34
First, preloading comes with a script delay. That can be problematic. Second, it is flakey. I don't bother with it much anymore. I llTriggerSound at a very low volume.  Don't get carried away, don't force people to download clips they may not end up hearing.
|
Harris Hare
Second Life Resident
Join date: 5 Nov 2004
Posts: 301
|
04-07-2005 21:31
In my experimentation, using llTriggerSound at a low volume doesn't gain you anything over using the normal preload function. The real problem here is that people sometimes simply can't download the next clip in under 10 seconds. How long it takes is factored by a lot of variables (size of the clip, its bitrate, etc) but mostly it has to do with the user's available bandwidth at that moment.
If they are in a busy area, their bandwidth might already be at capacity downloading other world data (avatar movement, other sounds, nearby objects). No amount of script timing or fine tuning can change that. The only real thing you can do is try preloading more clips before hand and having a much longer delay before the music begins.
Sometimes it can work, but don't forget that you have a cache and when you listen to a sound the second time, you don't always have to re-download it. While others do if they haven't heard it before. It becomes very difficult to test unless you know how to clear your buffer each time (like I did). =p
|
Zindorf Yossarian
Master of Disaster
Join date: 9 Mar 2004
Posts: 160
|
04-08-2005 05:26
Ok. The way that my script works is that it preloads the first clip on touch, and then plays it. Then it sets a timer event for every 8.9 seconds (My clips are 9 seconds long) that plays the next clip (With queuing on, of course) and starts preloading the next one. The first few clips work perfectly, but around the fourth or fifth, it just borks out. It might be a problem with the script, though. I don't think that bandwidth for downloading should be a major problem. We can stream music through parcels, which probably takes more bandwidth than loading clips. So it should be possible to download the clips faster than they play. Another thing, is there a limit to how much music you can preload?
_____________________
Badass Ninja Penguin: Killing stuff it doesn't like since sometime in May 2004.
|
Harris Hare
Second Life Resident
Join date: 5 Nov 2004
Posts: 301
|
04-08-2005 09:49
The problem is buffering.. or the nature of it anyway. From what I can tell, SL will only allow a client to be "loading" a single sound clip at a time. If they are large sound clips they can be around 120KBytes in size. Eventually you'll get to a point in your loop when the time it takes to buffer the next clip just isn't enough. Your fighting so many variables... size of the clip, your queue order, sim lag. It can be a real headache. Trust me on this. I spent a month writing my iPod script, trying a dozen different ways trying to make it buffer better and found that nothing was 100% reliable before giving up.
In fact, I found that a 9 or 10 second sound clip can take anywhere between only 5 seconds all the way up to 15 seconds to buffer depending on the conditions the moment you start buffering it. Furthermore, if someone else plays another sound nearby (especially a long one), it'll throw your whole buffering out of wack because like I said, SL will only allow you to be downloading one sound at a time. The downloads basically get "queued" in the order they were recieved.
It got to the point that I actually built a "prebuffer" mode on my iPod that would actually prebuffer each sound of a song for 20 seconds (which would take 6 minutes for a 3 minute song) before it ever bagan playing it. =p At least then, I knew the clips "should" all be bufferred.
|
Zindorf Yossarian
Master of Disaster
Join date: 9 Mar 2004
Posts: 160
|
04-12-2005 08:55
I found that the most reliable indicator of how the script will work is to look at the bandwidth-o-meter. A low average bandwidth is, for obvious reasons, the most conducive to sound playing. Also, importing the sound at 32 kbps helps a lot.
_____________________
Badass Ninja Penguin: Killing stuff it doesn't like since sometime in May 2004.
|