[flac-dev] FLAC-compress data with Python

Erik de Castro Lopo mle+la at mega-nerd.com
Sat Mar 15 03:56:42 PDT 2014

Nouvelle Collection wrote:

> I would like to compress some data, stored in a Numpy Array (Python) with
> something like (*):
> flac.compress(my_array)
> without having to put data in a .wav file, without having to deal with
> containers, etc.,
> i.e. :
> *raw data in / raw data out*
> Do you have an idea on how to do that with FLAC?

I am not aware of any FLAC Python bindings. However, libsndfile supports
FLAC and there is a Python/Numpy binding here:


> This could be useful for audio data of course (stored in simple arrays),
> but also for other kind of sampled data : I can imagine that FLAC can be
> useful on lots of different kinds of data (mainly for those whose waveforms
> look like continuous function, like audio data), isn't it true ?

Yes, anything that is vaguely continuous sampled data can be stored in a
FLAC file.

Erik de Castro Lopo

More information about the flac-dev mailing list