exportFile writes generated audio data to a WAV file. Before calling it, convert a Signal into SampleData, assemble an Audio record with sample rate and channel count, and keep samples within a safe range. section 10.1.2
A typical export pipeline:
- Clamp the signal before conversion so its values remain below the audio limits. section 10.1.2
- Convert samples into an array-backed SampleData value with listArray. section 10.1.2
- Construct Audio with the sample rate, one channel, and converted sample data. section 10.1.2
- Call Codec.Wav.exportFile with the destination FilePath and Audio value. section 10.1.2
Export four waveforms
writeWav "4waves.wav" $ concatMap (\w -> tone w 220 5) [Sound.Synth.sin, tri, saw, sqw] generates five-second tones and writes them to 4waves.wav. section 10.1.2
