liveBook · Manning

Waveform

As explained in Learn Haskell by Example

A waveform is the shape of a signal as it varies over time, especially the periodic shape used to define a tone.

A waveform describes one repeating period of a signal. In digital sound, it is modeled as a function from a position between 0 and 1 to a sample value between -1 and 1. section 10.1.2

Generating a tone

Represent a waveform as `type Wave = Double -> Sample`, then scan its positions repeatedly. The number of samples per period determines frequency; mapping those values across a duration produces a signal.

Figure 10.2 Four standard waveforms
figure

Compare the four standard waveform shapes across one period. section 10.1.2

How Learn Haskell by Example covers it

How deep it goes
Defines waveform functions and connects periodic sampling to frequency, stopping before later volume modulation.
Examples
Uses sine, square, sawtooth, and triangle functions to create a 220-Hz exported audio file.
What it assumes
Assumes familiarity with numeric type classes and introduces waveform modeling through functions and sampled values.
What you can do after
Build it from scratch in Haskell by defining waveforms and producing sampled tones.
How it connects
Connects waveforms with signals, samples, frequency, tone generation, and timbre.

Also explained in

Compare how 2 books explain waveform →

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.