cl qoa


An implementation of the Quite Okay Audio format.

About cl-qoa

This is an implementation of the Quite OK Audio format, modelled after the reference implementation.

How To

First, raw-decode a file from any storage supported by binary-structures, like a stream, file, or raw pointer.

(org.shirakumo.qoa:read-file file)

Now with the file in memory, you can decode it to a sample buffer:

(org.shirakumo.qoa:decode-file *)

It will return the raw signed-byte 16 buffer. You can also use decode-to-buffer to decode the audio piecemeal. To query the file attributes, you can use channels and samplerate.

Similarly, you can encode a sample buffer into a QOA file.

(org.shirakumo.qoa:encode-from-buffer samples)

Which can then be written out to any supported storage backend again.

(org.shirakumo.qoa:write-file * file)

In both cases, samples are stored interleaved. You can get the channel order for each particular count of channels with the channel-layout function.

If you just need to convert a WAV file, you can use the convert-wav function. It requires the samples to be in SINT16 format and will error on any other format. If you need to convert samplerates or sample format, you can use a tool like ffmpeg to pre-convert it.

(let ((path "myfile.wav"))
  (uiop:run-program (list "ffmpeg" "-i" (uiop:native-namestring path)
                          "-c:a" "pcm_s16le" "-y" (uiop:native-namestring path)))
  (org.shirakumo.qoa:convert-wav path))

System Information

Yukari Hafner

Definition Index