cl flac
1.0.0Bindings to libflac, a simple FLAC decoding library
Table of Contents
About cl-flac
This is a bindings library to libflac, a simple library for decoding FLAC files.
How To
Precompiled versions of the underlying library are included in this. If you want to build it manually however, refer to the libflac page.
Load the system through ASDF or Quicklisp:
(ql:quickload :cl-flac)
Create a new file
object:
(defvar *file* (cl-flac:make-file #p"~/my-cool-music.flac"))
You can query the file information with samplerate
, channels
, sample-count
, frame-count
, and bits-per-sample
.
Reading samples from the file happens with read-directly
, read-into-vector
, or read-to-vector
. A basic playback loop could look like this:
(loop with buffer = (make-array 512 :element-type 'single-float)
for samples = (cl-flac:read-into-vector *file* buffer)
until (= 0 samples)
do (process-buffer-somehow buffer))
When you're done with the file, you can either just let it be GCd or close it explicitly with close-file
.
A complete test that allows you to play back a flac file is included in test.lisp
System Information
Definition Index
-
CL-FLAC
- ORG.SHIRAKUMO.FRAF.FLAC
No documentation provided.-
EXTERNAL STRUCTURE FILE
Container for the FLAC file. Note that you do not need to explicitly close the file. It will automatically clean up when this instance is garbage collected. See MAKE-FILE See CLOSE-FILE See HANDLE See PATH See CHANNELS See SAMPLERATE See BITS-PER-SAMPLE See SAMPLE-COUNT See FRAME-COUNT See READ-DIRECTLY See READ-INTO-VECTOR See READ-TO-VECTOR See SEEK
-
EXTERNAL FUNCTION BITS-PER-SAMPLE
- FILE0
- &REST
Returns the number of bits per sample as encoded in the file. See FILE
-
EXTERNAL FUNCTION CHANNELS
- FILE0
- &REST
Returns the number of channels that the file encodes. See FILE
-
EXTERNAL FUNCTION CLOSE-FILE
- FILE
- &REST
Explicitly close the file. Note that this will render the instance useless. See FILE
-
EXTERNAL FUNCTION FRAME-COUNT
- FILE0
- &REST
Returns the number of frames stored in the file. This is the number of samples divided by the number of channels, this giving the number of frames. See SAMPLE-COUNT See FILE
-
EXTERNAL FUNCTION HANDLE
- INSTANCE
- &REST
Accessor to the handle for the underlying C data of the FLAC file. See FILE
-
EXTERNAL FUNCTION (SETF HANDLE)
- VALUE
- INSTANCE
- &REST
No documentation provided. -
EXTERNAL FUNCTION MAKE-FILE
- PATH
- &REST
Create a new FLAC file from the given path. If the path is not accessible, or the file is malformatted, an error is signalled. See FILE
-
EXTERNAL FUNCTION READ-DIRECTLY
- FILE
- BUFFER-POINTER
- BUFFER-SIZE
- &REST
Directly decode samples from the file into the buffer. BUFFER-SIZE is in number of bytes, but must be aligned with the sample size. The buffer is filled with 32-bit float samples. Returns the number of bytes successfully read. If this number is lower than the requested amount, the file has reached its end. See FILE
-
EXTERNAL FUNCTION READ-INTO-VECTOR
- FILE
- VECTOR
- &OPTIONAL
- START
- END
- &REST
Decode samples into the vector. The vector must have an element-type of either SINGLE-FLOAT, (SIGNED-BYTE 16), or (SIGNED-BYTE 32). Returned is the number of samples that were actually decoded, as that might be lower than the requested amount if the file does not contain enough samples anymore. See FILE
-
EXTERNAL FUNCTION READ-TO-VECTOR
- FILE
- SAMPLES
- &REST
Reads the given number of samples into a single-float vector. Returns the vector and the number of samples that were actually decoded. See READ-INTO-VECTOR See FILE
-
EXTERNAL FUNCTION SAMPLE-COUNT
- FILE0
- &REST
Returns the total number of samples stored in the file. See FRAME-COUNT See FILE
-
EXTERNAL FUNCTION SAMPLERATE
- FILE0
- &REST
Returns the samplerate of the file in Hertz. See FILE
-
EXTERNAL FUNCTION SEEK
- FILE
- FRAME
- &REST
Seek to the requested frame. Returns the file on success, signals a condition on failure. See FILE
-
CL-FLAC-CFFI
- ORG.SHIRAKUMO.FRAF.FLAC.CFFI
No documentation provided.-
EXTERNAL CONDITION ERROR
No documentation provided. -
EXTERNAL FUNCTION BITS-PER-SAMPLE
- FILE
- &REST
No documentation provided. -
EXTERNAL FUNCTION CHANNELS
- FILE
- &REST
No documentation provided. -
EXTERNAL FUNCTION ERROR
- DATUM
- &REST
- ARGUMENTS
- &REST
Invoke the signal facility on a condition formed from DATUM and ARGUMENTS. If the condition is not handled, the debugger is invoked.
-
EXTERNAL FUNCTION FRAME-COUNT
- FILE
- &REST
No documentation provided. -
EXTERNAL FUNCTION FREE-FILE
- FILE
- &REST
No documentation provided. -
EXTERNAL FUNCTION OPEN-FILE
- PATH
- FILE
- &REST
No documentation provided. -
EXTERNAL FUNCTION READ-F32
- DATA
- SAMPLES
- FILE
- &REST
No documentation provided. -
EXTERNAL FUNCTION READ-S16
- DATA
- SAMPLES
- FILE
- &REST
No documentation provided. -
EXTERNAL FUNCTION READ-S32
- DATA
- SAMPLES
- FILE
- &REST
No documentation provided. -
EXTERNAL FUNCTION SAMPLE-COUNT
- FILE
- &REST
No documentation provided. -
EXTERNAL FUNCTION SAMPLE-RATE
- FILE
- &REST
No documentation provided. -
EXTERNAL FUNCTION SEEK
- SAMPLE
- FILE
- &REST
No documentation provided. -
EXTERNAL FUNCTION STRERROR
- ERROR
- &REST
No documentation provided. -
EXTERNAL OPTIMIZER ERROR
No documentation provided. -
EXTERNAL TRANSFORM ERROR
No documentation provided.