flac: Complete high-level binding to libFLAC

[ audio, bsd3, codec, library ] [ Propose Tags ]

Complete high-level binding to libFLAC.

[Skip to Readme]
Versions [RSS] [faq] 0.1.0, 0.1.1, 0.1.2, 0.2.0
Change log CHANGELOG.md
Dependencies base (>=4.8 && <5.0), bytestring (>=0.2 && <0.11), containers (==0.5.*), data-default-class, directory (>=1.2.2 && <1.4), exceptions (>=0.6 && <0.9), filepath (>=1.2 && <1.5), mtl (>=2.0 && <3.0), semigroups (==0.18.*), text (>=0.2 && <1.3), transformers (>=0.4 && <0.6), vector (>=0.10 && <0.13), wave (>=0.1.2 && <0.2) [details]
License BSD-3-Clause
Author Mark Karpov <markkarpov@openmailbox.org>
Maintainer Mark Karpov <markkarpov@openmailbox.org>
Revised Revision 2 made by mrkkrp at 2017-01-12T00:09:52Z
Category Codec, Audio
Home page https://github.com/mrkkrp/flac
Bug tracker https://github.com/mrkkrp/flac/issues
Source repo head: git clone https://github.com/mrkkrp/flac.git
Uploaded by mrkkrp at 2017-01-04T10:39:09Z
Distributions LTSHaskell:0.2.0, NixOS:0.2.0, Stackage:0.2.0
Downloads 3004 total (20 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2017-01-04 [all 1 reports]



Manual Flags


Turn on development settings.

Automatic Flags

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees


Readme for flac-0.1.1

[back to package description]

FLAC for Haskell

License BSD3 Hackage Stackage Nightly Stackage LTS Build Status Coverage Status

This is a complete high-level Haskell binding to libFLAC.

Aims of the project

Here are several ideas the project follows:

  • Concentrate only on native FLAC format without messing with other audio formats or their flavors. This library is about FLAC only.

  • Be a complete interface for FLAC file manipulation in Haskell. “Complete” means that everything supported by the reference implementation should be supported by this package. This is in the hope to prevent fragmentation and proliferation of different libraries to work with FLAC with each of them covering only some 80% of functionality the library author needed and neglecting other 20%. A lot of effort was put to make the first libFLAC binding so good so you don't need another one.

  • Be as efficient as the underlying C implementation, avoid adding any sort of overhead (memory/speed/or otherwise).

  • Provide idiot-proof API using type system to kindly guard against bad things, but not so much to remain beginner-friendly and simple.

  • Make invalid code and data unrepresentable.


FLAC is awesome and Haskell is awesome, surely there should be a way to achieve an even higher level of awesomeness by coding a safe Haskell API to the fast libFLAC library.

Seriously though, we have htaglib to work with audio metadata, but it does not support a lot of FLAC-specific things I'd love to manipulate. We have hsndfile, but I don't really want to read FLAC data into a buffer or Haskell Vector. How simple it is (if possible) to decode a FLAC file using that library? How simple it is to figure out where to begin with such a task? With flac it's decodeFlac def "myfile.falc" "myfile.wav" — done, average song in a fraction of second.

Provided functionality

Here we go:

  • Metadata — full support for reading/writing/deleting of all audio parameters, application data, seek tables, vorbis comments of all sorts, CUE sheets, and even pictures.

  • Stream decoder — simple interface for decoding to vanilla WAVE and RF64 (support for files larger than 4 Gb).

  • Stream encoder — a lot of options to tweak, everything that libFLAC has, but you can also use def and just encode vanilla WAVE or RF64 file into native FLAC. Simple and efficient.


Right now there are three main limitations:

  • No Ogg FLAC support, and I do not plan to add it, but I'll accept a PR adding support for Ogg FLAC.

  • It's not possible to use custom callbacks for printing decoding/encoding progress in real-time and stuff like that. Not a big issue IMO, given that we get easy and safe API instead.

  • Only works on little-endian architectures so far, I'll accept a PR lifting this limitation.

Quick start

The best way to start using flac is to take a look at the Haddocks. Encoding and decoding is so simple that a baby could handle it, and for metadata there are examples and a lot of details in the docs. Feel free to ask me question if you get stuck with something though.

The following packages are designed to be used with flac:


Please kindly direct all issues, bugs, and questions to the GitHub issue tracker for this project.

Pull requests are also welcome and will be reviewed quickly.


Copyright © 2016–2017 Mark Karpov

Distributed under BSD 3 clause license.