To read and decode Monkey's Audio you need to follow these steps (these steps are roughly the same as in the section dedicated to flac):
- Open an .ape file with element type
(unsigned-byte 8)
. - Pass the stream to
ape:open-ape
function which will create and returnbitreader:reader
object. - Read metadata blocks, passing the object from previous step to
ape:read-metadata
. - Read frames with
ape:read-frame
. This method accept the number of frame you wish to be read as the third argument. Total number of frames in the file can be accessed throughmetadata-total-frames
function. - Decode the frame with
ape:decode-frame
and repeat the previous step until all data is read and decoded.
API
Conditions.ape-error
General APE error
metadata
Option | Value |
Constructor: | make-metadata |
Predicate: | metadata-p |
Copier: | copy-metadata |
version
Option Value Type: (easy-audio.core:ub 16)
Read Only: nil
Accessor: easy-audio.ape:metadata-version
Initform: 0
padding1
Option Value Type: (easy-audio.core:ub 16)
Read Only: nil
Accessor: easy-audio.ape::metadata-padding1
Initform: 0
desc-len
Option Value Type: (easy-audio.core:ub 32)
Read Only: nil
Accessor: easy-audio.ape::metadata-desc-len
Initform: 0
header-len
Option Value Type: (easy-audio.core:ub 32)
Read Only: nil
Accessor: easy-audio.ape::metadata-header-len
Initform: 0
seektable-len
Option Value Type: (easy-audio.core:ub 32)
Read Only: nil
Accessor: easy-audio.ape::metadata-seektable-len
Initform: 0
wavheader-len
Option Value Type: (easy-audio.core:ub 32)
Read Only: nil
Accessor: easy-audio.ape::metadata-wavheader-len
Initform: 0
audiodata-len
Option Value Type: (easy-audio.core:ub 32)
Read Only: nil
Accessor: easy-audio.ape::metadata-audiodata-len
Initform: 0
audiodata-len-high
Option Value Type: (easy-audio.core:ub 32)
Read Only: nil
Accessor: easy-audio.ape::metadata-audiodata-len-high
Initform: 0
wavtail-len
Option Value Type: (easy-audio.core:ub 32)
Read Only: nil
Accessor: easy-audio.ape::metadata-wavtail-len
Initform: 0
header-md5
Option Value Type: t
Read Only: nil
Accessor: easy-audio.ape::metadata-header-md5
compression-type
Option Value Type: (easy-audio.core:ub 16)
Read Only: nil
Accessor: easy-audio.ape:metadata-compression-type
Initform: 0
format-flags
Option Value Type: (easy-audio.core:ub 16)
Read Only: nil
Accessor: easy-audio.ape::metadata-format-flags
Initform: 0
blocks-per-frame
Option Value Type: (easy-audio.core:ub 32)
Read Only: nil
Accessor: easy-audio.ape:metadata-blocks-per-frame
Initform: 0
final-frame-blocks
Option Value Type: (easy-audio.core:ub 32)
Read Only: nil
Accessor: easy-audio.ape:metadata-final-frame-blocks
Initform: 0
total-frames
Option Value Type: (easy-audio.core:ub 32)
Read Only: nil
Accessor: easy-audio.ape:metadata-total-frames
Initform: 0
bps
Option Value Type: (easy-audio.core:ub 16)
Read Only: nil
Accessor: easy-audio.ape:metadata-bps
Initform: 0
channels
Option Value Type: (easy-audio.core:ub 16)
Read Only: nil
Accessor: easy-audio.ape:metadata-channels
Initform: 0
samplerate
Option Value Type: (easy-audio.core:ub 32)
Read Only: nil
Accessor: easy-audio.ape:metadata-samplerate
Initform: 0
total-samples
Option Value Type: (easy-audio.core:ub 32)
Read Only: nil
Accessor: easy-audio.ape:metadata-total-samples
Initform: 0
bittable
Option Value Type: t
Read Only: nil
Accessor: easy-audio.ape::metadata-bittable
seektable
Option Value Type: t
Read Only: nil
Accessor: easy-audio.ape::metadata-seektable
open-ape
(stream)
Open ape audio file and return bitreader for further operations
read-metadata
(reader)
Read ape metadata using
reader
returned by open-ape
read-frame
(reader metadata n)
Read the
n
-th audio frame from reader
. metadata
is the
metadata structure for this audio file.decode-frame
(frame)
Decode an audio frame. Return a list of decoded channels. Each
channel is a simple array with elements of type
(signed-byte 32)
.with-open-ape
((reader name) &body body)
Open ape file with the pathname
name
and creates reader
for that file. The file is closed when the control leaves body of this
macro.seconds=>frame-number
(metadata seconds)
Return the number of a frame whose play time is
seconds
from
the beginning of file.