Author Topic: FlxSound Edit - Seamless Embedded Audio!  (Read 10603 times)

Geti

  • Active Member
  • ***
  • Posts: 143
  • Karma: +0/-0
    • View Profile
    • 1 Bar Design
FlxSound Edit - Seamless Embedded Audio!
« on: Fri, Dec 3, 2010 »
ORIGINS HERE, DOWNLOAD HERE.
If worst comes to worst, mirror Here.

Please be aware that the seamless looping only works for embedded audio! Feel free to rig up the correct system to pass streaming audio through the extraction function if you like (and if you do, please get in contact and I'll upload your modification) but for now if you just need looping background tracks, this will do nicely.


HOW TO USE THIS:

The function loadEmbedded has changed to take 3 arguments now:

Code: [Select]
loadEmbedded(EmbeddedSound:Class,Looped:Boolean=false,totalSamples:int=0)
EmbeddedSound is still the reference to your sound variable
Looped still indicates whether or not to loop the sound when playing
totalSamples must be known about the track in question.

Open the sound file in whatever sound editing program you want to use, find out the number of samples, and put that (usually very large) number into the function call. WITHOUT THE NUMBER OF SAMPLES THE LOOPED AUDIO WON'T PLAY AT ALL!


That's the only thing that's changed that you really need to know about unless you're going to tinker. Feel free to drop me a line if you need to know about them.

Thanks to cai and ill13 for their help yesterday, even if I went my own way with the final solution ;)
« Last Edit: Sat, Jan 22, 2011 by Geti »

initials

  • Contributor
  • ****
  • Posts: 378
  • Karma: +0/-0
  • Initials
    • View Profile
    • Initials Blog. Code and other things.
Re: FlxSound Edit - Seamless Embedded Audio!
« Reply #1 on: Tue, Dec 7, 2010 »
This is great!
I was looking for exactly this earlier this year.
Thank you!
Initials: Super Lemonade Factory, Super Lemonade Factory Part Two, Above The Clouds, Revvolvver, Four Chambers of the Human Heart

Geti

  • Active Member
  • ***
  • Posts: 143
  • Karma: +0/-0
    • View Profile
    • 1 Bar Design
Re: FlxSound Edit - Seamless Embedded Audio!
« Reply #2 on: Wed, Dec 8, 2010 »
No worries, I figured it was a major limitation when it came to background loops so I took care of it :)

zuperxtreme

  • Contributor
  • ****
  • Posts: 254
  • Karma: +0/-0
    • View Profile
    • Buddah
Re: FlxSound Edit - Seamless Embedded Audio!
« Reply #3 on: Thu, Dec 9, 2010 »
Very nice, will most likely use this in the near future. :)
..."without order nothing exists, without chaos nothing evolves"... 
Zoklet.net

ill13

  • Member
  • **
  • Posts: 18
  • Karma: +0/-0
    • View Profile
    • ill13.com
Re: FlxSound Edit - Seamless Embedded Audio!
« Reply #4 on: Mon, Dec 13, 2010 »
I will be using this!

Thank you!

Geti

  • Active Member
  • ***
  • Posts: 143
  • Karma: +0/-0
    • View Profile
    • 1 Bar Design
Re: FlxSound Edit - Seamless Embedded Audio!
« Reply #5 on: Wed, Dec 15, 2010 »
Hahah, no worries ill13 :) cheers for the help getting started on it.

Geti

  • Active Member
  • ***
  • Posts: 143
  • Karma: +0/-0
    • View Profile
    • 1 Bar Design
Re: FlxSound Edit - Seamless Embedded Audio!
« Reply #6 on: Thu, Jan 13, 2011 »
Updated with a mirror and possibly fixed links.

Geti

  • Active Member
  • ***
  • Posts: 143
  • Karma: +0/-0
    • View Profile
    • 1 Bar Design
Re: FlxSound Edit - Seamless Embedded Audio!
« Reply #7 on: Sat, Jan 22, 2011 »
Links fixed permanently now :)

paala

  • Contributor
  • ****
  • Posts: 250
  • Karma: +0/-1
    • View Profile
Re: FlxSound Edit - Seamless Embedded Audio!
« Reply #8 on: Sat, May 7, 2011 »
How can I figured out how many samples did a mp3 have?
I didn't find any program that can do that

bobbybaker82

  • Active Member
  • ***
  • Posts: 155
  • Karma: +0/-0
    • View Profile
Re: FlxSound Edit - Seamless Embedded Audio!
« Reply #9 on: Mon, May 9, 2011 »
Goldwave is free and shows that information.  http://goldwave.com/

tackle

  • Member
  • **
  • Posts: 18
  • Karma: +0/-0
    • View Profile
    • karlmacklin.com - blog/portfolio
Re: FlxSound Edit - Seamless Embedded Audio!
« Reply #10 on: Mon, May 9, 2011 »
So is the sample length to be checked when in WAV format?

Surely, the starting silence from the MP3 format must count for some samples do we count these as well?

Also, I suppose the same question goes for the ending silence.

Geti

  • Active Member
  • ***
  • Posts: 143
  • Karma: +0/-0
    • View Profile
    • 1 Bar Design
Re: FlxSound Edit - Seamless Embedded Audio!
« Reply #11 on: Fri, May 13, 2011 »
If you run a "trim silence" filter over the whole thing, that's the audio you want to sample. Audacity can count the number of samples in an audio file via selection, which is another viable method.

Essentially, it'll start from ~3k samples in and go for as many samples as you tell it to.

test84

  • Key Contributor
  • *****
  • Posts: 1328
  • Karma: +0/-0
  • ت
    • View Profile
    • My personal site.
Re: FlxSound Edit - Seamless Embedded Audio!
« Reply #12 on: Sat, Mar 3, 2012 »
I wanted to use this but FlxG changed and this cannot be replaced with current FlxSound.

Any workarounds?
blog, twitter, Check out my award winning game, Rot Gut:

paala

  • Contributor
  • ****
  • Posts: 250
  • Karma: +0/-1
    • View Profile
Re: FlxSound Edit - Seamless Embedded Audio!
« Reply #13 on: Mon, Mar 5, 2012 »
@test84  just use adobe flash cs 3-5 to encode the wav 

test84

  • Key Contributor
  • *****
  • Posts: 1328
  • Karma: +0/-0
  • ت
    • View Profile
    • My personal site.
Re: FlxSound Edit - Seamless Embedded Audio!
« Reply #14 on: Mon, Mar 5, 2012 »
@paala: thanks but I don't have it and other option, mp3loops doesn't create perfect loops.

And you mean MP3, right?
« Last Edit: Mon, Mar 5, 2012 by test84 »
blog, twitter, Check out my award winning game, Rot Gut:

Geti

  • Active Member
  • ***
  • Posts: 143
  • Karma: +0/-0
    • View Profile
    • 1 Bar Design
Re: FlxSound Edit - Seamless Embedded Audio!
« Reply #15 on: Mon, Mar 5, 2012 »
I dont have time to update this, sorry folks :P

xyroclast

  • Contributor
  • ****
  • Posts: 389
  • Karma: +0/-0
    • View Profile
Re: FlxSound Edit - Seamless Embedded Audio!
« Reply #16 on: Wed, Nov 7, 2012 »
Would anyone like to pick up the torch on updating the new FlxSound to work in 2.55? FlxG seems to have become incompatible with it, but I imagine it might be one of those fairly simple things where methods/variables have changed names/positions.

Didn't want to dig into it myself, in case I wasn't going about it in the best way.

byrono

  • Global Moderator
  • Member
  • *****
  • Posts: 75
  • Karma: +0/-0
    • View Profile
Re: FlxSound Edit - Seamless Embedded Audio!
« Reply #17 on: Fri, Nov 9, 2012 »
This is Amazing

IQAndreas

  • Member
  • **
  • Posts: 35
  • Karma: +0/-0
    • View Profile
    • IQAndreas.com
Re: FlxSound Edit - Seamless Embedded Audio!
« Reply #18 on: Thu, Jan 10, 2013 »
I might be able to take a look at it. (FlxSound has become a bit of a love child of mine as of lately)

Which version of Flixel was the modified version of the code originally written for? (shame on you, Geti, for not using version control! ;)


... actually, FlxSound is more of an adopted child, since Adam was the original father.

Geti

  • Active Member
  • ***
  • Posts: 143
  • Karma: +0/-0
    • View Profile
    • 1 Bar Design
Re: FlxSound Edit - Seamless Embedded Audio!
« Reply #19 on: Wed, Mar 6, 2013 »
As far as I remember this was from ~Flixel 2.34 days.

Apologies for not having it versioned somewhere, gonna have to play the "young and innocent" card there as this was programmed well before I'd done much professional programming work or developed "good" programming practices.

The port should really not be that much of an issue, it just trims the MP3 padding and loops it earlier - if the method names have changed it should hopefully be trivial.