Audio in a program is sampled sound: a sequence of numeric values measured over time. Mono audio uses one signal; stereo uses two. Sampling approximates a continuous analog signal, so sample rate sets samples per second and bit resolution affects representation accuracy and signal-to-noise ratio. section 10.1
Figure 10.1 Sampling of an analog signal
Sampling turns a continuously changing waveform into discrete values at fixed time intervals. section 10.1
A practical mono representation uses `Sample = Double` and `Signal = [Sample]`, with a 44.1 kHz sample rate. Frequencies (`Hz`) and durations (`Seconds`) are also `Double`; converting a duration or period into a sample count requires rounding because partial samples cannot exist. section 10.1.1
Generate basic synthesized audio by treating a waveform as a function over one normalized period:
- Define `Wave` as a function from a position between 0 and 1 to a sample value. section 10.1.2
- Use sine, square, sawtooth, or triangle functions to produce different sound characteristics. section 10.1.2
- Repeat period positions for the requested duration; faster traversal yields a higher frequency. section 10.1.2
- Keep initial sample values between -1 and 1, then clamp signals before export to avoid excessive output values. section 10.1.2
Export four waveforms
Generate five-second 220 Hz tones from sine, triangle, sawtooth, and square waves, concatenate them, and write the resulting mono signal to a WAV file. WAV output converts samples to `Int16`, records the sample rate and channel count, and exports the audio data. section 10.1.2
Audio signals can become the output of synthesizer components. An `Oscillator` wraps `Event -> Signal`: silence events create zero-valued samples, while tone events combine a selected waveform, frequency, duration, and ADSR envelope. Multiple oscillators can therefore give the same event distinct timbres. section 10.3.2 section 10.3


