If you know the length of that gap (usually 25 ms) you can stop the playback of that file accordingly, that's what I tried in my new set of Classes. It's not perfect but with a little tweeking it's possible to obtain something good ...
Of course if your sounds are really short, then this is not a solution. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Patrick Matte|BLITZ Sent: 15 août 2007 14:06 To: flashcoders@chattyfig.figleaf.com Subject: RE: [Flashcoders] Class to loop sound objects in order But isn't there a small "glitch" in the song between each loop because of the mp3 compression? I thought the only way to get rid of the glitch was to export every sound as a swf. BLITZ | Patrick Matte - 310-551-0200 x214 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alain Rousseau Sent: Wednesday, August 15, 2007 4:53 AM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] Class to loop sound objects in order you can check out these set of classes I created for something similar to what you need. it doesn't loop each mp3 files but, creates a song based on an array of mp3 files . You can modify it as you wish to fit your needs but the simplest thing would be to just to repeat the filename in the array [file1, file1, file1, file2, file3, ... ] http://lab.daroost.ca/2007/02/25/sondloop2-revisited-musicbuilder-soundobjec t/ HTH Alain [EMAIL PROTECTED] wrote: > Hi there, thanks for checking my post. I am trying to create a class that will play a number of mp3 loops each a specified number of times and in the specified order. I have tried to find an existing class but cant find one anywhere. > > My solution (which may not be that efficient), is to create all of the sound objects in the fla then load the mp3s into them. When they are all loaded each sound object is added to a new object that holds it as well as a 'loops' property that says how many times the sound object must play. These objects are then put into an array in the order they are to be heard. This array is passed to my LoopSound class that controls the playback. I can also pass a 'loopForever' property that will make the series repeat indefinitely. > > The problem I am having is re-triggering the play() function from within my LoopSound Class to move onto the next sound in the array. I am sure that there will be a much neater way of achieving what I want, and maybe even a pre-written class! > > Any direction / suggestions / encouragement much appreciated :) > > Thanks! > Danny > > > > //this code would create an instance of the class in the FLA > > > var mySound:Sound = new Sound(); > mySound.loadSound("sounds/gas.mp3", false); //once sound is loaded: > var my_ar:Array = new Array(); > //create object to add to array > var myOb:Object = new Object(); > myOb.sound = mySound; > //is to play 3 time > myOb.loops = 3; > my_ar.push(myOb); > var myLooper:LoopSound = new LoopSound(my_ar) > > > Here is the class: > > > //this class is designed to play a number of already loaded sound objects sequentially, each sound object can be looped for a specified number of times then the whole series can be repeated infinitely. Th constructor is passed an array of objects that have sound and loop properties that contain a sound object and the number of times the sound object is to be looped. > > > class LoopSound { > private var sounds_ar:Array; > //sound playing currently > var currSound:Sound; > //which stage of the array we are currently up to > private var mp3Count:Number = 0; > //if this series of loops is meant to keep playing until they are stopped > private var loopForever:Boolean; > //receives array that holds objects that have the key sound & loops > public function LoopSound(a:Array, lF:Boolean) { > trace("loopsound created:"+a); > mp3Count = 0; > sounds_ar = new Array(); > sounds_ar = a; > loopForever = lF; > this.play(); > } > private function play() { > trace("Loopsound started playing"); > trace("mp3 count:"+this.mp3Count+":"+sounds_ar); > currSound = sounds_ar[mp3Count]["sound"]; > //creating local vars for targetting from currSound complete > var mp3C:Number = mp3Count; > var snds_ar:Array = sounds_ar; > //calculate number of times mp3 is to loop > var currLoops:Number = sounds_ar[mp3Count]["loops"]; > currSound.start(0,currLoops); > currSound.onSoundComplete = function() { > //if there are more sound objects to play iterate thru array and retrigger play() > if (mp3Count<snds_ar.length) { > mp3Count++; > //this bit isn't working! > play(); > } else { > if (loopForever) { > mp3Count = 0; > this.play(); > } else { > //all sound objects have played and play() is not retriggered > mp3Count = 0; > } > } > }; > } > } > > _______________________________________________ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > > > _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.476 / Virus Database: 269.11.19/953 - Release Date: 2007-08-14 17:19 No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.476 / Virus Database: 269.11.19/953 - Release Date: 2007-08-14 17:19 _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com