SiON provides a simple sound synchronization with DisplayObject and an easy dynamic sound generation. You can generate various sounds without any mp3 files and wave data.The musical sequence is represented as Music Macro Language (a simple text data), Standard MIDI Files or MOD files. It makes your sounding SWF file very very small.

[Flash 10]

Janvier 2014 (update fev 2015)

Playing Midi chiptune files with Flash

[swfobj src=”” alt=”Animation Flash” width=”320″ height=”200″ class=”flashObject” AllowScriptAccess=”sameDomain” allowfullscreen=”false” bgcolor=”#FFFFFF” required_player_version=”10″]

The API is pretty straightforward, here the 4 steps to enable midi sound in your Flash game.

var driver:SiONDriver = new SiONDriver(4096);
var smfData:SMFData = new SMFData();
smfData.loadBytes( new MidiFileClass() ); // ByteArray;

But, the result may vary. In my quick test 3 out 8 mid are perfectly played by SiON driver.

*** update feb 2015
using 8bitboy, you can play MOD files.

Karsten Obarski invented 1987 – twenty years ago – the MOD format for his Ultimate Tracker running on Amiga computers. Since then, countless songs are created, especially for the demoscene.

MODs have special attributes. All samples are stored in 8bits and the number of voices is limited to four. To have something similarly to chords, the three notes of it are repeated very fast. This makes MODs sound so freaky.

Finally 8BitBoy brings those songs back online.

[swfobj src=”” alt=”Animation Flash” width=”320″ height=”240″ class=”flashObject” AllowScriptAccess=”always” allowfullscreen=”false” bgcolor=”#FFFFFF” required_player_version=”10″]

There is a complete setup in the wiki, the only thing you have to do is to include the .swc and add the 8bitboy package to your project.

bitboy.setChannelPanning(0, -0.5);
bitboy.setChannelPanning(1, 0.5);
bitboy.setChannelPanning(2, 0.5);
bitboy.setChannelPanning(3, -0.5);
bitboy.setFormat( new ModFile() );  // ByteArray