11.3 Summary#
In this chapter, “sampling” means lifting a clip of audio, a sample, from one recording and reusing it in another context. A sample is a contiguous chunk \([x[m], \ldots, x[m + M - 1]]\) of a recording, whose offset \(m \in \{0, \ldots, N - M\}\) and length \(M\) are usually chosen by ear rather than procedurally.
Sequencing plays samples back in new orders and with new timing. In Pyquist, a sequence of samples is just a
pq.Scorewhose instrument returns samples, from a chopped breakbeat to the grid of a drum machine. Musical time is counted in beats, at a tempo measured in beats per minute (BPM).Sample-based synthesis pre-records musical material and manipulates it on the fly to change its expressive parameters, filling in the combinations of pitch, duration, and loudness that were never recorded. It is realistic, cheap to compute, and easy to implement, but it uses a lot of memory.
Pitch: resampling a recording by the ratio \(\frac{T_1}{T_2} = 2^{k/12}\) shifts its pitch by \(k\) steps, but also scales its duration by \(2^{-k/12}\). Multisampling keeps \(|k|\) small, for realism.
Duration: a sustain loop replaces the recorded sustain with as many repetitions as a note needs, keeping the attack and release. A period is rarely a whole number of audio samples, so good loops span many periods, and a crossfade smooths over each wrap.
Loudness: mapping a loudness \(\ell \in (0, 1]\) linearly onto \(-80\) to \(0\) dB, and \(\ell = 0\) to silence, gives a simple volume control that matches our logarithmic perception of loudness.