jolonf / flac-pascal

FLAC decoder in Pascal
The Unlicense
8 stars 0 forks source link
flac pascal

flac-pascal

FLAC decoder in Pascal.

Usage

The FLAC unit in flac.pas contains a FLAC decoder which can be invoked using the following function:

function FLAC2PCM(flac: TStream; 
                  pcm: TStream; 
                  var streamInfoBlock: TStreamInfoBlock): LongWord;
  TStreamInfoBlock = record
    sampleRate:           DWord; 
    numberOfChannels:     Word;  
    bitsPerSample:        Word;  
    totalSamplesInStream: Int64; 
    bytesPerSample:       Integer;
  end;

The PCM format produced is big endian, interleaved channels, where the bytes per sample is rounded up to the nearest byte, e.g. if the FLAC file contains 20 bits per sample, it will be rounded up to 24 bits (3 bytes). TStreamInfoBlock.bytesPerSample also contains the bytes per sample of the PCM.

Sample Program

Included is a sample program FLACTester.pas which converts a test.flac file to test.pcm. It also prints out the TStreamInfoBlock for the FLAC file.

Supported