Notice:
I have updated SWFer and have made several large changes. The code no longer sucks and it now supports more things. I don't have time to properly update this page currently (it needs a complete rewrite with my changes), so I will leave the original post below. The project is now hosted on Github. The latest version can be downloaded here.
The old original post/page:
SWFer is an application for decompiling and compiling SWF files. It is currently in a very early pre-alpha stage, but I will be making a pre-alpha release with very limited (but hopefully stable) functionality. It was inspired by the complete lack of gaplessly looping MP3 files in SWFs not made with Adobe Flash. I was working on a little game in FlashDevelop and was disappointed that I couldn't get the audio track to properly gaplessly loop. Given my prior experience with FFmpeg, I decided I would find out why and how Adobe Flash created properly looping MP3s and see if I couldn't make a tool to facilitate creating gapless MP3 loops.
The download for the current pre-alpha version of SWFer can be found here. Feedback can be submitted here. (Update: Please don't download this version, as it has been superseded by a new release; see the top of this page for more information)
I cannot stress the pre in pre-alpha release enough. The code is currently horrible, mostly because I've been hacking around at the binary level trying to get the generated SWFs to work as well as they do. I'm releasing this early because a) it's useful, and b) early feedback will help me improve SWFer. The code is going through a massive overhaul, however, even if the end-user doesn't see any noticeable changes.
How to use SWFer: A micro-tutorial
Simply run SWFer, select your source audio file (either a FLAC or WAV), adjust quality parameters (or leave them as they are), give the sound an ActionScript 3 class name, and save the SWF!
Most planned features are disabled in SWFer, and the only available feature is creating SWFs that contain a gaplessly looping MP3. I'll be the first to admit the user interface is not optimal, but for now I'm focusing on features instead of UI, and hopefully it's easy and obvious enough.
How do I use the generated SWF file in my FlashDevelop project?
Let's say you made a SWF file called "MySWF.swf" and inside it you put a sound that you gave the ActionScript 3 class name of "MySound". Loading it is as easy as:
package { import flash.media.Sound; [Embed(source = 'MySWF.swf', symbol='MySound')] public class MyImportedSound extends Sound { } }
Then, to use the imported sound, all you need to do is:
var s:Sound = new MyImportedSound(); s.play(0, 0); // Feel free to loop using the last parameter of play()
Faux-FAQ
- If I already have an MP3 file, can I use SWFer to make a gaplessly looping SWF?
- Currently, no. SWFer needs a gapless audio file as a source input (currently I only allow WAV and FLAC) in order to generate a gapless SWF+MP3. MP3s always have an intro and outro gap (technically, it's possible to make a gapless MP3, but it's complex and no encoder+decoder that I know of does), so if you are using an already-existing MP3, SWFer can't do necessary pre-processing to determine how to skip the gaps. Someday, I'd like to add some automatic heuristic guessing to remove gaps from already existing MP3s and allow users to manually tweak settings.
- What platforms are supported?
- Currently, only Windows. The code is cross-platform, however, and I plan to release OS X and Linux builds (someday).
- Does SWFer reduce the quality of my audio?
- Not any more than encoding to an MP3 does. SWFer uses the FFmpeg project libraries and LAME, which is one of, if not the, highest quality MP3 encoders available.
- How does SWFer gaplessly loop MP3s?
- If you're tech-savvy and open a SWF file in a hex editor or some program, you can find two tags: a DefineSound tag, which actually defines a sound and contains its sample data, and the StartSound (or StartSound2) tag, which starts playing a sound and declares how many beginning samples to skip. If you know the number of samples for the starting and ending gaps in your MP3, you can set the StartSound tag to skip the right number of samples for the starting gap, and then set the right number of samples to play in the DefineSound tag so that it stops playing before the end gap starts.
- What is SWFer's license?
- SWFer is licensed under the GNU GPL. See its corresponding license file for more information. I may consider changing the license in the future, but I make no promises. Don't worry, your generated SWF files are yours to keep and don't fall under the GPL.
- Where can I learn more about the SWF file format?
- SWF File Format Specification Version 10
- Where can I learn more about ActionScript 3 byte code?
- ActionScript Virtual Machine 2 (AVM2) Overview
- Why is it "Faux-FAQ" and not just "FAQ?"
- Because I've never been asked any questions about this, so these aren't really frequently asked questions. They're just ones I assume are useful to know.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.