wave: Work with WAVE and RF64 files

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

Work with WAVE and RF64 files.

[Skip to Readme]


[Index] [Quick Jump]


Manual Flags


Turn on development settings.


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

Package maintainers

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS] 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.2.0
Change log CHANGELOG.md
Dependencies base (>=4.7 && <5.0), bytestring (>=0.2 && <0.12), cereal (>=0.3 && <0.6), containers (>=0.5 && <0.7), transformers (>=0.4 && <0.7) [details]
License BSD-3-Clause
Author Mark Karpov <markkarpov92@gmail.com>
Maintainer Mark Karpov <markkarpov92@gmail.com>
Revised Revision 2 made by mrkkrp at 2023-06-20T16:32:25Z
Category Codec, Audio
Home page https://github.com/mrkkrp/wave
Bug tracker https://github.com/mrkkrp/wave/issues
Source repo head: git clone https://github.com/mrkkrp/wave.git
Uploaded by mrkkrp at 2019-01-28T21:14:02Z
Distributions LTSHaskell:0.2.0, NixOS:0.2.0, Stackage:0.2.0
Reverse Dependencies 3 direct, 2 indirect [details]
Downloads 5285 total (39 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2019-01-28 [all 1 reports]

Readme for wave-0.2.0

[back to package description]


License BSD3 Hackage Stackage Nightly Stackage LTS Build Status

This module provides a safe interface that allows to manipulate WAVE files in their “classic” form as well as files in the RF64 format. RF64 adds the ability to store files larger than 4 Gb.

The main feature of the API is that it does not allow the user to duplicate information and introduce errors in that way. For example, block align may be calculated from other parameters of audio stream, thus we do not store it in the Wave record and do not allow user to specify it. We provide, however, a way to calculate it given Wave record, see waveBlockAlign. The same is done for channels. Channel mask is a more general means of providing information about number of channels and corresponding speaker positions, thus we only store channel mask in user-friendly form, and number of channels can be derived from that information.

Another feature of the library is that it does not dictate how to read/write audio data. What we give is the information about audio data and offset in file where it begins. To write data the user may use a callback that receives a Handle as an argument. Size of data block is deduced automatically for you. Exclusion of audio data from consideration makes the library pretty fast and open to different ways to handle audio data itself, including using foreign code (such as C).

The library provides control over all parts of WAVE file that may be of interest. In particular, it even allows to write arbitrary chunks between fmt and data chunks, although it's rarely useful (and may actually confuse buggy applications that don't know how to skip unknown chunks).

Please read the Haddocks for a more detailed documentation, the usage should be trivial.


I needed a way to work with WAVE files to finish my flac package and for analyzing input data in WAVE format in general. The existing solutions (WAVE, wavy) are not maintained and poorly designed. It suffices to say that they read samples of audio stream and put them into a linked list, like [[Sample]] (the inner linked list is to store multi-channel data, yeah).

This wave package is the first serious solution in Haskell that allows to work with WAVE data safely and efficiently.


The library only supports PCM format with samples represented as integers and floating point values. Support for other formats will be added on request, please contact me at https://github.com/mrkkrp/wave/issues.


Issues, bugs, and questions may be reported in the GitHub issue tracker for this project.

Pull requests are also welcome and will be reviewed quickly.


Copyright © 2016–2019 Mark Karpov

Distributed under BSD 3 clause license.