Flod / FlodPro

Flod Logo

AS3 Amiga Soundtracker Module Replay class by Christian Corti

Update 18th June 2010:

Progress on Flod 3 is rapid. It now supports 18 different Amiga formats, including SoundFX, SidMon and more! It can even play tunes that are stored in zip files. Keep your eyes peeled on the blog for demos and news. This page will be updated as soon as it’s available for download.

What is Flod?

Using FLOD you can play Amiga tracker music in your AS3 / Flash Player 10 games and demos.

It has full support for:

  • 15/31 instruments
  • All effects up to ProTracker 2.3 including Inverse Loop
  • A500 and A1200 filters
  • Play / Pause / Resume controls

Flod adds less than 10kb to your SWF file size and uses very little CPU for replay.

FlodPro includes the complete source code to a  ProTracker style replay interface (shown below), including a cool flectrum effect (vu analyser) and the latest build of the Flod replay source. This will now play back more formats, better sounding than ever!

FlodPro v1 Interface

A full Sound Spectrum class should be available soon, meaning you can generate beautiful vu meters or link sounds/beats to in-game events.

Commercial Use License

Flod was a huge amount of work, and as such if you plan on using it in a commercial SWF the author requests you make a donation (minimum of $5) towards the project. “Commercial” means anything that is going to make money. This includes (but is not limited to): Flash games seeking sponsorship, Flash games with MochiAds / cpmStar / or any other form of advertising, games you will upload to Kongregate or NewGrounds (if it contains their ads API), and all forms of Flash work sold to clients  / publishers.

If your SWF will not directly earn you money (for example using it for music replay in a demo) then you are free to use it without paying.

To obtain a copy of your license please make your donation (minimum of $5) by PayPal to: chreil at hotmail dot com – if possible include a link to your project (more for our interest in seeing how Flod is used than anything else). You will receive a license back by email.

Download

Download FlodPro here:

FlodPro v1.0 Archive (95kb)

Or you can download the old first release of Flod here.

Flod v1.0 Archive (140kb)

It includes an example module and replay code. If you have any questions about it feel free to post them here.

Flod Beginners Guide

I was starting to receive a number of emails from people who wanted to simply know “how do I replay a mod?” – the FlodPro interface was confusing them, all they really wanted was the replay.

So I put together a bundle package to address this. It contains a tutorial for replaying a mod using Flod. There are versions for Flex SDK + FlashDevelop and also for CS4 included. Two versions of each are present – one that just replays the module, and one that displays the flectrum (vu-meter) as well, so you can pick whichever you need for your game/demo.

Download the Flod Beginners Guide (1.61mb)

Example

This is an example pf Flod in action. The Stats meter on the bottom left shows how little CPU is being used (and that includes the vu meter effects). Press 1-3 to switch between the songs and (P)ause and (R)esume.

Get Adobe Flash player

Documentation

Here are most of the class properties and methods:

ModProcessor Class

sound:Sound -  the internal Sound class instance
soundChannel:SoundChannel – the internal sound channel instance.
soundChannelPos:int – current position of the playing sound channel.
amigaModel:int – value can be ModProcessor.AMIGA_500 or ModProcessor.AMIGA_1200, set the corresponding filter type for the chosen model.
ledFilter:Boolean – enable/disable the Amiga led filter at the beginning of the song, during play the led filter can be enabled/disabled
by the corresponding tracker command.
loop:Boolean – true/false, if false the song will not keep playing, by default trackers do not stop the song at the end.

public function play(song:ModSong, sndProcessor:Sound = null):Boolean

parameters are the song to be played and a Sound class instance if you don’t want to use the internal one.

public function pause():void
pause the current playing song, just use “play” again to resume it.

public function stop():void
stop the current playing song.

ModSong Class

supported:Boolean -  true if the module is of a supported format, false otherwise.
version:int -  internal tracker version number.
ciaTimer:Boolean – not used yet.
title:String – the title/name of the song.
length:int
restart:int – restart position used by NoiseTracker to loop song.
tempo:int – current song tempo in bpm, default to 125.
numChannels:int – number of channels used by the song, currently only 4 channel modules are supported.
numPatterns:int – number of patterns in the song.
numSamples:int – number of samples in the song, can be 15 or 31 for Amiga modules.
patternLength:int – length of each pattern can be 64 or 100 for some late ProTracker modules.
positions:Vector.<int> – array containing the order in which the patterns should be played.
patterns:Vector.<ModCommand> – collection of patterns converted in ModCommand instances.
samples:Vector.<ModSample> – collection of samples used by the song converted in ModSample instances.

public function get tracker():String

return the name of the tracker used to compose the song (where possible)

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Ping.fm Post to Reddit Post to StumbleUpon

33 Responses to “Flod / FlodPro”

  1. Photon Storm » Blog Archive » FlodPro v1.0 Release Now Available with new ProTracker replay interface Says:

    [...] Grab the v1.0 download of FlodPro from the Flod page. [...]

  2. Phil Peron Says:

    Wow. Just… WOW.

    I absolutely can’t wait to start playing with this.

    Thanks, guys!

  3. ding Says:

    Why call it amiga sound tracker music? What formats does it play? mod, s3m,…? They were played and composed just as well on PC!

  4. Richard Davey Says:

    No, it doesn’t play S3M, just .mod files – the vast majority of which were created on the Amiga, and exist because of the Amiga.

  5. Phil Peron Says:

    Got everything quickly wired up and working on my test game demo!

    Quick question… I noticed that the load method signature for ModProcessor (could be others as well) are quite different between v1 and the latest pro release. Do you recommend using one over the other? I opted for the package under FlodPro as it only required me to do the following:

    var mp:ModProcessor = new ModProcessor();
    mp.load(modResource.data);
    mp.play();

    And bypass using ModSong at all. Is this considered ‘best practice’ or am I missing something obvious?

    Thanks!

  6. sascha/hdrs Says:

    This is awesomeness in cans!!

  7. Christian Corti Says:

    Hi everybody…

    ding: “Why call it amiga sound tracker music?”
    Flod is a replay routine based on the Sound/Noise/ProTracker software on the Amiga, it plays .mod only and it does try to emulate the real amiga hardware unlike most of the mod player out there.

    Phil Peron:
    You should use Flod version 2.0, the one included with FlodPro. The replay routine has been rewritten from scratch and is several times more compatible with weird mods and a little bit faster as well; and no you’re not missint anything… :)

    glad everbody likes it, have fun :)

  8. Christian Corti Says:

    just a quick note, the license has changed from free for all to free for non-commercial use…
    If you need to use it for any commercial project you can either use Flod 1.0 or just contact me…

  9. S’troidz!: Week 7 Update « Phil Peron Says:

    [...] has been one of my favorites for a long time. Richard along with Christian Corti released Flod, a module (.mod) replay library. This is a huge accomplishment. To get an idea of how this can [...]

  10. Christian Corti Says:

    Any comments, questions, bugs report, ideas, features request:

    flod@neoartcr.com

  11. Porter Says:

    Source code provided? that’s pretty awesome. I can’t wait to dig through this and see what’s going on. I’ve been very interested in working closer with sound in AS3, looking forward to checking this out, thanks.

  12. Paul Smith Says:

    Without recompiling the .as file in the zip, is there any way to make the flodpro.swf load and play automaticlly
    I love the program but dont know action script yet
    downloaded flash cs4 trial but dont understand how to compile.
    Im a GLBasic man usually .

    Thanks

  13. Ringo Says:

    Sweeeeeeet:)

  14. bm Says:

    When I try to load a .mod file created in MilkyTracker into FlodPro.swf (the one included in FlodPro_v1.zip) it fails with

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at neoart.flod::ModProcessor/load()
    at neoart.flod::ModProcessorEx/load()
    at neoart.flodpro::ProPlayer/loadCompleteHandler()

    I guess there’s something wrong with the settings I use. Did anyone try and succeed?

  15. Richard Davey Says:

    How many channels does it have? Flod only supports 4. Send me the mod if you like and I can test it here (rdavey@gmail.com)

  16. bm Says:

    That’s it, thanks.

    Problem was I assumed that unused channels don’t count, turns out they have to be removed (“Sub” button in Milky).

  17. Frank Says:

    I have exactly the same question as “Paul Smith” i would like to get rid of the file browser part and just play a .mod file wich is on the server. But my programming skills are 0, if someone could post a modified “Player.as” file i think Paul and me are very happy! :)

    Very very cool!, i read someone is also programming an sid player in flash/flex wich would be really cool too!

  18. Flod Beginners Guide now available for easy .mod replay in AS3 | Photon Storm Says:

    [...] You can download the Beginners Guide from the updated Flod page. [...]

  19. Flod Beginners Guide now available for easy .mod replay in AS3 | ArcadePortal Says:

    [...] You can download the Beginners Guide from the updated Flod page. [...]

  20. Frank Says:

    Many thanks for the guide!! think alot of people will be very happy with it.

  21. Paul Smith Says:

    Thanks Richard for the beginners Guide, Excellent work.

    Frank hope you got it working ok.
    I used the “basic mod replay with flectrum.swf” in the beginner guide zip and renamed my mod file to “the_enemy_within.mod” and it works great.

    And now I’ve just go the source to compile with Flashdevelop 3.0.6 and FlexSDK (all free, but bit of a pain to get working )
    Let me know if you want help with this

  22. Francis Lillie Says:

    Wow! What can I say apart from that? Up and running in my Flex engine in FlashDevelop in *minutes*, and works a treat. A fantastic bit of code and saves me the hassle of writing it myself. I was on the verge of digging out and converting my tracker code for the Amiga when a friend totld me about Flod. Massive thumbs up.

  23. Francis Lillie Says:

    I’m being lazy I know, but can someone point me to where a channel is triggered to play? I have an 8 frame Santa (2 frames for each limb) that I want to make “dance”, so need to change the state of each limb each time a channel is triggered. Cheers in advance.

  24. Francis Lillie Says:

    Ignore me. I’m. An. Idiot. Been away from this sort of stuff for too long.

  25. Fredrik Says:

    You’re awesome Chris, finally I actually get a use for the countless hours spent in front of Soundtracker when I was a kid :)
    Using the mod format is perfect for creating games with low filesizes.

    I’ll give you a initial donation when I finish my game, then a percentage of the income, people like you enhance the flash scene!

  26. Fredrik Says:

    Hi again,
    Really enjoying this player. Not sure if this would be of interest to anyone, but I was thinking that many portals want just one self-contained .swf file, which means no links to mod files. I did a workaround for this by converting the mod file to a image, then you can just save this as a PNG and import it into your library. I also did a function to convert the bitmapdata back into the same byteArray as before. Here’s a example of this in use: http://www.flashbutler.com/modplayer.swf

    Let me know if you want me to put the source up.

  27. Christian Says:

    Thnx, Fredrik, just wait for Flod 3.0 :)

  28. Thousand Thoughts » Fail: Audio :( Says:

    [...] for me. I’ll have to go for other alternatives for music playback. Maybe I’ll try out FlodPro by Richard Davey (which I actually wanted to [...]

  29. Thousand Thoughts » XM Audio, Second Try: Success! Says:

    [...] special thanks go to Richard Davey since I learned a lot from his FlodPro code. This is a quite decent chunk of work which I learned [...]

  30. T.S. Says:

    Hello,

    Does anyone know if it’s possible to embed .mod into .swf file (in Flash CS4) and use it as a resource, rather than load it with URLLoader?

  31. Richard Davey Says:

    TS – You can only do this by using an Embed command, which means you’ll need to compile with Flex SDK instead of the IDE.

  32. T.S. Says:

    Thank you Richard.
    I downloaded Flex SDK, added Embed directive and, much to my surprise, managed to compile swf inside Flash CS4. For a moment I thought I was going to have to move everything to new environment and re-code/design it all. Thanx again, finally finished that flash conversion of an old Amiga intro of mine. Good old times…

    Great work on the player, BTW. Amazing thing. Must say I wasn’t too interested in flash until I ran into flashtro.com site a week or so ago. Made me start learning AS3.

  33. rich Says:

    Cool, glad you got it working. Give me a shout when your intro is up on flashtro.com (I love that site!) always keen to see what fellow demo freaks are up to :)

Leave a Reply