QOA-Python

January 8, 2024 ยท View on GitHub

The Quite OK Audio Format for Fast, Lossy Compression

A Python wrapper around qoa Written using the CFFI library.

Why?

  • QOA is fast. It decodes audio 3x faster than Ogg-Vorbis, while offering better quality and compression (278 kbits/s for 44khz stereo) than ADPCM.
  • QOA is simple. The reference en-/decoder fits in about 400 lines of C. The file format specification is a single page PDF.
  • Multi-threaded - Cffi unlocks the GIL

Install

pip install qoa

Usage

You can use the qoa library to encode and decode audio files. Here's a basic example:

import qoa

# Read an audio file
np_array = qoa.read('path/to/file')

# Write an audio file
qoa.write(np_array , 'path/to/file')

# Encode an audio file
buffer = qoa.encode(np_array)