Skip to content

Latest commit

 

History

History
52 lines (34 loc) · 1.63 KB

README.md

File metadata and controls

52 lines (34 loc) · 1.63 KB

Flac Alchemy Encoder

Free Lossless Audio Codec (FLAC). This is a SWC that wraps the base functionality of the FLAC codec.

Building FLAC (optional)

Compile iLBC.swc (optional)

Download Adobe Alchemy

Download flex 4.6

Getting Started/Install Adobe Alchemy

After having installed Alchemy and Flex SDK, just run the commands below:

$ alc-on
$ make all

Example

Full Usage of flac.swc at src/net/sourceforge/flac/codec/FLACCodec.as

AS3 Code

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;