MyNixOS website logo
Description

Complete high-level binding to libFLAC.

FLAC for Haskell

License BSD3 Hackage Stackage Nightly Stackage LTS CI

This is a complete high-level Haskell binding to libFLAC—reference FLAC implementation.

As the maintainer of the C FLAC code base, I must say I'm impressed. Quite honestly, I think the C API is horrible.

Erik de Castro Lopo

Aims of the project

These are the goals of the project:

  • Be a complete interface for FLAC file manipulation in Haskell.
  • Be as efficient as the underlying C implementation.
  • Provide a safe API using type system to kindly guard against bad things, but not too much so as to remain beginner-friendly and simple.

Motivation

FLAC is awesome and Haskell is awesome, surely there should be a safe Haskell API to the fast libFLAC library!

Seriously though, we have htaglib to work with audio metadata, but it does not support FLAC-specific thing I would like to manipulate. We have hsndfile, but I don't really want to read FLAC data into a buffer or Haskell Vector. How simple is it (if possible) to decode a FLAC file using that library? How simple is it to figure out where to begin with such a task? With flac it is one line of code.

Provided functionality

flac can work with:

  • 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 WAVE and RF64.

  • Stream encoder—a lot of options to tweak, everything that libFLAC supports.

Limitations

Right now there are three main limitations:

  • No Ogg FLAC support, and I do not plan to add it; 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.

  • 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 should be simple to understand, for metadata there are examples in the docs. Feel free to ask me a question if you get stuck with something.

Related packages

The following packages are designed to be used with flac:

Contribution

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

Pull requests are also welcome.

License

Copyright © 2016–present Mark Karpov

Distributed under BSD 3 clause license.

Metadata

Version

0.2.1

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows