Easy Audio ยป Monkey's Audio

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):

  1. Open an .ape file with element type (unsigned-byte 8).
  2. Pass the stream to ape:open-ape function which will create and return bitreader:reader object.
  3. Read metadata blocks, passing the object from previous step to ape:read-metadata.
  4. 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 through metadata-total-frames function.
  5. 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 structure.
    metadata
    • version
      Type(easy-audio.core:ub 16)
      Readereasy-audio.ape:metadata-version
    • desc-len
      Type(easy-audio.core:ub 32)
      Readereasy-audio.ape::metadata-desc-len
    • header-len
      Type(easy-audio.core:ub 32)
      Readereasy-audio.ape::metadata-header-len
    • seektable-len
      Type(easy-audio.core:ub 32)
      Readereasy-audio.ape::metadata-seektable-len
    • wavheader-len
      Type(easy-audio.core:ub 32)
      Readereasy-audio.ape::metadata-wavheader-len
    • audiodata-len
      Type(easy-audio.core:ub 32)
      Readereasy-audio.ape::metadata-audiodata-len
    • audiodata-len-high
      Type(easy-audio.core:ub 32)
      Readereasy-audio.ape::metadata-audiodata-len-high
    • wavtail-len
      Type(easy-audio.core:ub 32)
      Readereasy-audio.ape::metadata-wavtail-len
    • header-md5
      Type(easy-audio.core:sa-ub 8)
      Readereasy-audio.ape::metadata-header-md5
    • compression-type
      Type(easy-audio.core:ub 16)
      Readereasy-audio.ape:metadata-compression-type
    • format-flags
      Type(easy-audio.core:ub 16)
      Readereasy-audio.ape::metadata-format-flags
    • blocks-per-frame
      Type(easy-audio.core:ub 32)
      Readereasy-audio.ape:metadata-blocks-per-frame
    • final-frame-blocks
      Type(easy-audio.core:ub 32)
      Readereasy-audio.ape:metadata-final-frame-blocks
    • total-frames
      Type(easy-audio.core:ub 32)
      Readereasy-audio.ape:metadata-total-frames
    • bps
      Type(easy-audio.core:ub 16)
      Readereasy-audio.ape:metadata-bps
    • channels
      Type(easy-audio.core:ub 16)
      Readereasy-audio.ape:metadata-channels
    • samplerate
      Type(easy-audio.core:ub 32)
      Readereasy-audio.ape:metadata-samplerate
    • total-samples
      Type(easy-audio.core:ub 32)
      Readereasy-audio.ape:metadata-total-samples
    • bittable
      Typet
      Readereasy-audio.ape::metadata-bittable
    • seektable
      Type(easy-audio.core:sa-ub 32)
      Readereasy-audio.ape::metadata-seektable
    Reading and decoding.
    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).
    Helpers.
    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.