Free Lossless Audio Codec (FLAC). This is a SWC that wraps the base functionality of the FLAC codec.
Getting Started/Install Adobe Alchemy
After having installed Alchemy and Flex SDK, just run the commands below:
$ alc-on
$ make all
Full Usage of flac.swc at src/net/sourceforge/flac/codec/FLACCodec.as
Methods encode and decode are asyncronous and take as their first params a callback for completed. yield is the number of loops of encodign before the program yields to the main process. It should be noted that this encoder accepts 16bit mono audio at 16000 hz, whereas the flash default is 32bit and the sample rate is controlled by mic.rate. If you wish to change this to any other value, you could easily just modify the FLAC__stream_encoder_set* inputs in the wrapper in c and recompile.
Imports
import cmodule.flac.CLibInit;
import org.ilbc.event.FLACEvent;
Initialization of lib
private var flacCodec:Object;
ilbcCodec = (new cmodule.flac.CLibInit).init();
Encode
encodedData = new ByteArray();
encodedData.endian = Endian.LITTLE_ENDIAN;
flacCodec.encode(encodingCompleteHandler, encodingProgressHandler, rawPCMByteArray, encodedData, decodedData.length, yield);
Progress Handler
function progressHandler(progress:int):void;