- Open a FLAC file/Get a stream with element type
(unsigned-byte 8)
. - Pass the stream to
flac:open-flac
function which will create and returnbitreader:reader
object. This object allowseasy-audio
library to read not just octets, but any amount of bits from audio stream. - Read metadata blocks from the stream, passing the object from previous
step to
flac:read-metadata
. - Do whatever you want with metadata and read the first audio frame with
flac:read-frame
. - Decode the frame with
flac:frame-decode
and repeat previous step until all data is read and decoded.
flac:*out-buffers*
variable with buffers returned by
flac:make-output-buffers
.API
Conditions.flac-error
General (unspecified) flac error
flac-bad-metadata
Flac metadata error
metadata
Current metadataOption Value Allocation: instance Type: nil
Initarg: :metadata
Readers: (flac-metadata)
flac-bad-frame
Bad flac frame
CLASSNAME-SLOTNAME
.
streaminfo
Option | Value |
Superclasses: | (metadata-header t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Class for storing STREAMINFO metadata block
minblocksize
The minimum block size (in samples) used in the streamOption Value Allocation: instance Type: alexandria:non-negative-fixnum
Accessors: (streaminfo-minblocksize)
maxblocksize
The maximum block size (in samples) used in the streamOption Value Allocation: instance Type: alexandria:non-negative-fixnum
Accessors: (streaminfo-maxblocksize)
minframesize
The minimum frame size (in bytes) used in the streamOption Value Allocation: instance Type: alexandria:non-negative-fixnum
Accessors: (streaminfo-minframesize)
maxframesize
The maximum frame size (in bytes) used in the stream. May be 0 to imply the value is not known.Option Value Allocation: instance Type: alexandria:non-negative-fixnum
Accessors: (streaminfo-maxframesize)
samplerate
Sample rate in HzOption Value Allocation: instance Type: alexandria:non-negative-fixnum
Accessors: (streaminfo-samplerate)
channels
Number of channels in stream. May be from 1 to 8.Option Value Allocation: instance Type: (integer 1 8)
Accessors: (streaminfo-channels)
bitspersample
Bits per sample (from 4 to 32)Option Value Allocation: instance Type: alexandria:non-negative-fixnum
Accessors: (streaminfo-bitspersample)
totalsamples
Total samples in stream. May be 0 if unknown.Option Value Allocation: instance Type: alexandria:positive-integer
Accessors: (streaminfo-totalsamples)
md5
MD5 checksum of the whole unencoded dataOption Value Allocation: instance Type: nil
Accessors: (streaminfo-md5)
seektable
Option | Value |
Superclasses: | (metadata-header t) |
Metaclass: | standard-class |
Default Initargs: | nil |
SEEKTABLE metadata block
seekpoints
List of seekpointsOption Value Allocation: instance Type: list
Accessors: (seektable-seekpoints)
seekpoint
Option | Value |
Constructor: | make-seekpoint |
Predicate: | seekpoint-p |
Copier: | copy-seekpoint |
A seekpoint (entry in seektable)
samplenum
Option Value Type: (easy-audio.core:ub 64)
Read Only: nil
Accessor: easy-audio.flac:seekpoint-samplenum
Initform: 0
offset
Option Value Type: (easy-audio.core:ub 64)
Read Only: nil
Accessor: easy-audio.flac:seekpoint-offset
Initform: 0
samples-in-frame
Option Value Type: (easy-audio.core:ub 16)
Read Only: nil
Accessor: easy-audio.flac:seekpoint-samples-in-frame
Initform: 0
vorbis-comment
Option | Value |
Superclasses: | (metadata-header t) |
Metaclass: | standard-class |
Default Initargs: | nil |
VORBIS_COMMENT metadata block
vendor-comment
Vendor commentOption Value Allocation: instance Type: string
Accessors: (vorbis-vendor-comment)
user-comments
List of user commentsOption Value Allocation: instance Type: list
Accessors: (vorbis-user-comments)
cuesheet
Option | Value |
Superclasses: | (metadata-header t) |
Metaclass: | standard-class |
Default Initargs: | nil |
CUESHEET metadata block
catalog-id
Media catalog numberOption Value Allocation: instance Type: string
Accessors: (cuesheet-catalog-id)
lead-in
For CD-DA cuesheets, number of lead-in samples; 0 otherwiseOption Value Allocation: instance Type: nil
Accessors: (cuesheet-lead-in)
cdp
t if cueshhet corresponds to Compact DiskOption Value Allocation: instance Type: boolean
Accessors: (cuesheet-cdp)
tracks
List of tracksOption Value Allocation: instance Type: list
Accessors: (cuesheet-tracks)
picture
Option | Value |
Superclasses: | (metadata-header t) |
Metaclass: | standard-class |
Default Initargs: | nil |
PICTURE metadata block
picture-type
One of 21 picture types (see flac format description)Option Value Allocation: instance Type: easy-audio.flac::picture-type-id
Accessors: (picture-type)
mime-type
String with MIME typeOption Value Allocation: instance Type: string
Accessors: (picture-mime-type)
description
Picture description (UTF-8 coded string)Option Value Allocation: instance Type: string
Accessors: (picture-description)
width
Picture widthOption Value Allocation: instance Type: alexandria:positive-integer
Accessors: (picture-width)
height
Picture heightOption Value Allocation: instance Type: alexandria:positive-integer
Accessors: (picture-height)
depth
Picture color depthOption Value Allocation: instance Type: alexandria:positive-integer
Accessors: (picture-depth)
color-num
Number of colors in indexed picture, 0 for non-indexedOption Value Allocation: instance Type: alexandria:non-negative-integer
Accessors: (picture-color-num)
picture
The picture itself as array of octetsOption Value Allocation: instance Type: (easy-audio.core:sa-ub 8)
Accessors: (picture-picture)
frame
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Audio frame class
blocking-strategy
Is the blocking strategy :FIXED (frame header contains the frame number) or :VARIABLE (frame header contains the sample number)Option Value Allocation: instance Type: (member :fixed :variable)
Readers: (frame-blocking-strategy)
block-size
Block size in samplesOption Value Allocation: instance Type: alexandria:non-negative-fixnum
Readers: (frame-block-size)
sample-rate
Sample rateOption Value Allocation: instance Type: alexandria:non-negative-fixnum
Readers: (frame-sample-rate)
channel-assignment
Number of channels or one of :mid/side, :left/side, :right/sideOption Value Allocation: instance Type: (integer 0 10)
Readers: (frame-channel-assignment)
sample-size
Bits per sampleOption Value Allocation: instance Type: (integer 4 32)
Readers: (frame-sample-size)
number
Frame/sample numberOption Value Allocation: instance Type: unsigned-byte
Initform: 68719476736
Readers: (frame-number)
crc-8
CRC8 of a frame header (including the sync code)Option Value Allocation: instance Type: (easy-audio.core:ub 8)
Accessors: (frame-crc-8)
subframes
List of subframes (one for each channel)Option Value Allocation: instance Type: list
Accessors: (frame-subframes)
crc-16
CRC16 of the frame (back to and including the sync code)Option Value Allocation: instance Type: fixnum
Accessors: (frame-crc-16)
read-frame
(stream &optional streaminfo)
Read a frame from a stream
frame-decode
(frame)
Decode a frame destructively modifying (and garbaging) all subframes within.
Returns list of decoded audio buffers (one buffer for each channel).
open-flac
(stream)
Return
bitreader
handler of flac streamread-metadata
(bitreader)
Return list of metadata blocks in the stream
seek-sample
(bitreader sample &key seektable streaminfo)
Seeks to an interchannel sample.
Sets input to new frame, which contains this sample.
Returns position of this sample in the frame.
seektable
and streaminfo
are optional. Providing streaminfo
enables
additional sanity checks. Currently only fixed block size is supported.metadata-find-seektable
(metadata)
Return a seektable from metadata list if any
make-output-buffers
(streaminfo)
Make output buffers for binding with
*output-buffers*
to reduce consingwith-output-buffers
((streaminfo) &body body)
Calls to READ-FRAME can be made inside this macro to avoid unnecessary consing
if flac stream is of fixed block size
flac:open-ogg-flac
, flac:read-ogg-metadata
and flac:read-ogg-frame
functions for that purpose. Seeking does not work with OGG container.