liveBook · Manning

HCodecs

As explained in Learn Haskell by Example

HCodecs is a Haskell library for reading, encoding, and writing audio codec formats including WAV files.

HCodecs is a Haskell library for writing generated audio as WAV files. A typical workflow converts a signal into SampleData, wraps it in an Audio record, and exports it with Codec.Wav.exportFile. section 10.1.2

Exporting generated waves

writeWav "4waves.wav" (concatMap (\w -> tone w 220 5) [sin, tri, saw, sqw]) writes five-second, 220 Hz sections for four waveforms to a playable WAV file.

How Learn Haskell by Example covers it

How deep it goes
Explains dependency setup, sample-array conversion, clamping, Audio construction, and export, while deferring array internals.
Examples
Uses sine, triangle, sawtooth, and square waves combined into a four-waveform WAV export.
What it assumes
Assumes basic Haskell project setup and signals, while introducing SampleData arrays and Audio construction as needed.
What you can do after
Build it from scratch by converting signals into Audio values and exporting them through Codec.Wav.exportFile.
How it connects
Connects audio signals with WAV files, sample data, arrays, sample rates, channels, and waveform generation.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Haskell by Example. The section links point to the parts of the book it draws on.