BSD-3-Clause licensed and maintained by Mark Karpov
This version can be pinned in stack with:wave-0.2.1@sha256:34fcedb08a84fcc373a59e415c4477836d4daa7bce41673b6ccb097864ab1700,1900

Module documentation for 0.2.1

Used by 2 packages in nightly-2024-03-14(full list with versions):

Wave

License BSD3 Hackage Stackage Nightly Stackage LTS CI

This library provides a safe interface that allows us 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, the block alignment can be calculated from other parameters of an audio stream, thus we do not store it in the Wave record and do not allow the user to specify it. We provide, however, a way to calculate it given a Wave record, see waveBlockAlign. The same is true for the number of channels. The channel mask is a more general means of providing the information about the number of channels and the corresponding speaker positions, thus we only store the channel mask.

Another feature of the library is that it does not dictate how to read or write the audio data. To write the audio data the user passes a callback that receives a Handle as an argument. The size of the written data block is deduced automatically. This makes the library fast and open to different ways of handling the audio data, including via foreign code.

Motivation

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

Limitations

The library only supports PCM format with samples represented as integers and floating point values.

Contribution

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

Pull requests are also welcome.

License

Copyright © 2016–present Mark Karpov

Distributed under BSD 3 clause license.

Changes

Wave 0.2.1

  • Maintenance release with more modern and minimal dependencies.

Wave 0.2.0

  • Got rid of data-default-class dependency. Wave now is not an instance of Default.

Wave 0.1.6

  • Dropped support for GHC 7.8.

Wave 0.1.5

  • Improved documentation and metadata.

Wave 0.1.4

  • The library now doesn’t write zero extra format information size when fmt chunk is not extensible. Previously it wrote zero size.

Wave 0.1.3

  • Adjust and document guessing of channel mask from number of channels alone for files with non-extensible fmt chunks.

Wave 0.1.2

  • Switched to using withBinaryFile instead of withFile, because the latter does nasty conversions on Windows, see docs for openBinaryFile.

Wave 0.1.1

  • Added *.rf64 audio samples to the distribution to allow the tests pass.

Wave 0.1.0

  • Initial release.