|
|
Question : loadSound vs. attachSound - latency latency latency...
|
|
Hope this hasn't been asked so frequently that its painful to answer.
My goal: Load sounds dynamically into a Flash movie (keep the sounds on the server, pass XML with urls to Flash) and then loop a few simultaneously. Everything works 100% except for a small detail when it comes to looping.
I find that if I import my mp3s into the library and export them for action script I can use the following code in the onMovieClip(load) block of an arbitrary clip:
mySound.attachSound("loop.mp3") mySound.onSoundComplete = function(){ this.start(); } mySound.start();
Obviously, once this sound starts it will loop forever. It works great. I cannot even tell when the sound stops and when it starts again. (I am familiar with mySound.start(offset,loops) but its not ideal in this situation, in fact it doesn't even change the outcome).
The problem is I don't want to embed the sounds in my flash file. I want the user to decide if they want to download and play them.
So...
I drop the sounds on my server and use a dynamically generated XML page to transfer the urls for each sound so I can use the loadSound() function to load them. I load them as event sounds (isStreaming = false).
All this works fine and they play... but:
When I loop them (either with start(offset, loops) or using the onSoundComplete hack) there is a noticable delay between when the loop ends and when it start again... grrr...
Has anyone else had similar difficulties? Is the only solution to convert each audio file into its own flash movie and load them that way? It seems a little bit cumbersome. All the references I've read on the matter seem to suggest that the flash movie technique is the way to go though. I suspect that's why there are programs to batch the operation..
Wanted: An elegant solution to this seemingly simple problem. Preferably not creating movies for each sound but I will concede if that is the only way to go..
Thank you for your time.
|
Answer : loadSound vs. attachSound - latency latency latency...
|
|
i've now been triing it myself and it i also get a gap even with a very low bitrate mp3
I made the loop wit Frootyloops and saved it as an mp3 But it turned out it did not save it correctly (with a gap in the beginning and a gap in the end)so i've cut the silence away with cooledit and tried it again and now it worked file without the gap
I don't know if you got any sound editting programs but if you do take a look at the mp3 and it could be that the problem is there. If you don't have any soundediting programs you can always mail the mp3 to me and i'll take look
[email protected]
|
|
|
|