~~NOTOC~~ ====== GaplessLoopedSound ====== ---- dataentry extension ---- author_mail : Cooper description : Allows smooth, gapless, looped playback of mp3's. Resolving the mp3 issue which causes a click when it loops mid music lastupdate_dt : 2013-12-23 compatible : v1.4.1 # the Starling version you tested the extension with depends : # if the ext. depends on others, list them here tags : mp3, looped, Sound # enter a few tags, separated by commas homepage_url : https://gist.github.com/mountainstorm/8106250 download_url : https://gist.github.com/mountainstorm/8106250 ---- ===== Overview ===== Starling2D extension to allow playing of looped mp3's without the 'click' as it loops (due to the issue with mp3 frame sizes). In short mp3's are terrible for looping. The way the codec works you end up with encoder and decoder delay at the start and potential padding at the end. When this plays you gets little gap when it loops :( Thankfully there is a solution if you've used LAME to do the encoding. To use this library you have four choices (in preference order): 1. (Recommended) var rain:Sound = GaplessLoopedSound.createWithLAME(assets.getByteArray("rain")); 2. var rain:Sound = new GaplessLoopedSound(assets.getSound("rain"), delay, padding) 3. var rain:Sound = GaplessLoopedSound.createWithGuess(assets.getSound("rain"), originalSampleLength); // guesses 4. var rain:Sound = new GaplessLoopedSound(assets.getSound("rain")); // uses some defaults which might work ===== Changelog ===== * //2013/12/23 23:07//: First public version ===== Source Code ===== %gist(8106250)% ===== User Comments ===== //Feel free to edit this part of the page!//