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.
