Author Topic: AS3 Sfxr  (Read 4678 times)

SFBTom

  • Guest
AS3 Sfxr
« on: Mon, Sep 28, 2009 »
Hey all,

If you haven't played with sfxr before, you're definitely missing out! It's a sound effect generation app that's great for making classic game style sounds and spitting them out as .wav files. And I ported it to AS3, you know, for fun :)

I spotted that someone posted about my project as3sfxr (ah Google vanity searches, how I love thee)

I also saw the update saying that their experience when using it in an actual game was pretty bad. I actually hadn't done much benchmarking in a real game context, but I did so after reading that post, and oh boy, turns out they were right! My bad...

So, after a hectic week at Flash On The Beach, I picked up the project again and had a go at making it a lot faster and more usable.

Now, there are two ways to play a sound. You can either choose to generate the sound as it plays, or to cache the sound and play it later. The first is of course quick for creation, but slower when actually playing (not that slow though, just slower than the caching option). Caching synthesizes the full sound in one go, then stores the ByteArray to read out of when you play. You should probably cache your sounds during loading, transitions or other non-action times.

The playMutated() method is available for both types of playing too. It slightly modifies the sound, but keeps the original settings so you never stray too far. No more repetitive sound effects!

Take a look at the google code project for really simple examples and the source:
http://code.google.com/p/as3sfxr/

Check out the app here. You can copy and paste setting straight out to your code, which is a lot easier than trying to find a good sound by hand:
http://www.superflashbros.net/as3sfxr/

I'd love to hear from anyone who tries out the code, I just finished it about an hour ago so it's not super tested. Enjoy!

Tom-

Adam Atomic

  • Founder
  • Key Contributor
  • *****
  • Posts: 852
  • Karma: +0/-0
  • new dad
    • View Profile
    • Adam Atomic
Re: AS3 Sfxr
« Reply #1 on: Mon, Sep 28, 2009 »
whoa whoa whoa!  this is very huge and exciting, I will try and check it out in a week or two when things slow down here...not to sound ungrateful or impatient, but any plans to port musagi as well??  Having built-in support for native SFXR and Musagi formats is one of my longterm dreams for flixel...

SFBTom

  • Guest
Re: AS3 Sfxr
« Reply #2 on: Mon, Sep 28, 2009 »
I'd not heard of musagi before, but after a quick Google I've caught up.

Porting musagi would be a pretty intense task, made a lot harder by the fact that as far as I can see, it isn't open source. Manually matching a synthesizers magic numbers is really tricky, and the native file format would be nearly impossible to figure out :(

I am however working (more code doodling than working really) on a simple chip tune tracker, from scratch. Not sure if I'll continue it yet though.

Tom-

jellybit

  • Guest
Re: AS3 Sfxr
« Reply #3 on: Tue, Sep 29, 2009 »
Excellent!  Thank you very much, SFBTom!  By the way, have you heard of PxTone?  It's a pretty nice chiptune composition/playback program.  The source is included with that, and it's actually used by a lot of people.  If you're unfamiliar with it, it's programmed by Pixel who made Cave Story.  PROTIP: To use the program in English, delete "japanese.ico".
« Last Edit: Tue, Sep 29, 2009 by Jellybit »

SFBTom

  • Guest
Re: AS3 Sfxr
« Reply #4 on: Sun, Oct 4, 2009 »
I had a look at PxTone too, another great chip tune tracker. I couldn't find the source for it though. There're some source files in that zip, but not the whole app.

I think with sounething as small as sfxr, it made sense to pretty much port it over, then optimise it for AS3 after. But with something larger like these apps, the architecture is going to be written to take advantage of the language, and porting to AS3 becomes a bigger challenge. I'd prefer to do it from scratch, perhaps taking inspiration from other apps, but ultimately writing it for AS3. I'll end up with faster, neater code, which is what I'd always want from any open source project.

Tom-

SFBTom

  • Guest
Re: AS3 Sfxr
« Reply #5 on: Wed, Oct 14, 2009 »
whoa whoa whoa!  this is very huge and exciting, I will try and check it out in a week or two when things slow down here...not to sound ungrateful or impatient, but any plans to port musagi as well??  Having built-in support for native SFXR and Musagi formats is one of my longterm dreams for flixel...

I've had a word with DrPetter, and he's very kindly shared the playback source for Musagi! I've already started porting it over to AS3 - just the playback though, not the whole app. Feel free to add as3sfxr and the musagi port to Flixel when I'm done, I'd love to have as many people as possible use them. Gives me the warm fuzzies to know my code is useful to anyone :)

Tom-

jellybit

  • Guest
Re: AS3 Sfxr
« Reply #6 on: Wed, Oct 14, 2009 »
You are a true world hero of champions.

luc

  • Member
  • **
  • Posts: 97
  • Karma: +0/-0
  • no ablo anything except french
    • View Profile
    • scribbles
Re: AS3 Sfxr
« Reply #7 on: Thu, Oct 15, 2009 »
Xmas time !
thank you sir.

Adam Atomic

  • Founder
  • Key Contributor
  • *****
  • Posts: 852
  • Karma: +0/-0
  • new dad
    • View Profile
    • Adam Atomic
Re: AS3 Sfxr
« Reply #8 on: Wed, Oct 21, 2009 »
WHOOAAA that is awesome news :D  drpetter (and you!!) are the best!  Definitely looking forward to being able to include that in the future