Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sound doesn't loop properly

Status
Not open for further replies.

firegambler

Technical User
Sep 25, 2002
455
AT
Hi,

Please help me with the following.

I created an audio menu (which can be seen on at the bottom of the page).
Even though the soundfiles are cut very precisely the sound doesn't loop properly. There is always a tiny delay before they start over.
The loop files can be found on:

Especially loop2 (which can be heard when dragging the top right disc to the player and closing the player) is causing headache!

Here is my fla:

Please have a look at the files and give me some advice!
Thanks in advance!


regards

tektips.gif
 
I downloaded one of the loops (the 'Shaft' one)and it has a very brief period of silence on the beginning and end, I chopped them off in the Flash sound editor and it looped fine as a sound on the main timeline.

I think that reloading the soundfile each time the music function executes is probably adding a delay too even though the mp3 is cached, maybe this would be quicker (there's also the problem of trying to precisely control a streaming sound so this is set to event):

Code:
	s.onLoad = function() {
		s.start();
	s.onSoundComplete = function() {
			s.start();
		};
	};
	s.loadSound("[URL unfurl="true"]http://koschitz.org/florian/fjhpneu/sounds/loop"+selected+".mp3",[/URL] false);

Some nice things happening in the site by the way, good work.
 
I've allways noticed that there tends to be more of a delay in the loop if using a .mp3 rather than a .wav.
That said, I've removed your onSoundComplete function from the first one, and that already seems to help significantly.
Code:
function music(){
//using selected load the appropriate sound 
s.loadSound("[URL unfurl="true"]http://koschitz.org/florian/fjhpneu/sounds/loop"+selected+".mp3",[/URL] true);
s.start();
//when sound ends load it again by recursion
//s.onSoundComplete = music;
};
s.onSoundComplete = function() { 
	s.start();
};

The way you were doing it, would technically go through the loadSound again, and maybe that's where the added delay came from.

You could also further reduce it by adding an offset, and a loop factor, likewise...
Code:
function music(){
//using selected load the appropriate sound 
s.loadSound("[URL unfurl="true"]http://koschitz.org/florian/fjhpneu/sounds/loop"+selected+".mp3",[/URL] true);
s.start();
//when sound ends load it again by recursion
//s.onSoundComplete = music;
};
s.onSoundComplete = function() { 
	s.start(.02,999);
};

Suggest you also allways add this to your sound object's definition, which although MM says the parameter is optional, would keep you out of other possible problems...

cdplayer.cdlade.stop();
cdplayer.cdlade.cdlade.stop();
playerstatus = "open";
s = new Sound(this);

I would also suggest you disable all other selections (the other records buttons), when one selection has been made, or is at least engaged in the player. Otherwise if you click any other selection while one is playing, that selection still keeps on playing, although the record pops up back in place, as a possible selection.

Lastly, suggest you re-code all your preloaders, including your initial one on the 3D ball, to remain invisible if the movies are already cached. It would avoid us seeing flash frames of the preloader bars upon a refresh of the browser or a subsequent visit to the site.

Regards,

cubalibre2.gif
 
Hi Oldnewbie, hi Wangbar,

unfortunately I have to work for an exam on Monday (Finance Mathematics :-( ), so Monday night after the test I'll be back on track to try everything!

Thanks a lot for your replies and effort, I really appreciate that!

regards

tektips.gif
 
I have had this problem before too and I tried many things to solve it. The solution I found was to import the sound (and then export for actionscript in the linkage menu) and use attachSound, instead of loadSound.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top