liveBook · Manning

Timbre

As explained in Learn Haskell by Example

Timbre is the qualitative character of a sound that distinguishes sounds with similar pitch and loudness.

Timbre is the qualitative character that makes sounds with similar pitch and loudness feel different. A practical shortcut is to shape signals with different waveforms rather than study overtones first. section 10.1.2

Figure 10.2 Four standard waveforms
figure

Compare sine, square, sawtooth, and triangle waveforms as four standard starting points for creating different sound qualities. section 10.1.2

Represent timbre through a small Haskell signal pipeline:

  • Define a Wave as a function from a normalized position between 0 and 1 to a sample value. section 10.1.2
  • Implement sine, square, sawtooth, and triangle waves as mathematical functions returning sample values from -1 to 1. section 10.1.2
  • Repeat period samples according to frequency, then fill the requested duration to produce a tone. section 10.1.2

Exporting four timbres

Generate five-second, 220 Hz tones with each waveform, concatenate them, clamp the signal, and write the result to a WAV file. section 10.1.2

How Learn Haskell by Example covers it

How deep it goes
Defines timbre briefly, then implements four waveform functions and connects period sampling to generated tones.
Examples
Uses sine, square, sawtooth, and triangle waves, then exports their concatenated tones as a WAV file.
What it assumes
Assumes familiarity with numeric type classes before introducing waveform and signal implementation.
What you can do after
Builds distinct tones from waveform functions and writes the resulting signal to a WAV file.
How it connects
Connects timbre with waveforms, frequency, signals, samples, tones, and volume modulation.

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.