2.0 Review: digital audio is an array of numbers#
To briefly recap Chapter 1, digital audio on a computer is just an array of numbers \(x[n]\), together with a sample rate \(f_s\). Each item in this discrete array constitutes a sample from continuous sound \(x(t)\):
so \(x[0]\) is the value at \(t = 0\), \(x[1]\) is the value at \(t = 1 / f_s\) seconds, and so on.
While digital audio is often quantized as \(b\)-bit signed integers when stored on disk, here we will forego quantization and work with \(x[n]\) as floating-point numbers in nominal range \([-1, 1]\). In practice, when synthesizing or manipulating samples in memory, we almost always use floating point numbers, as mixing, filtering, and synthesis are all easier in float arithmetic. Integer quantization and clipping typically only matter when we read or write files to disk.
This chapter focuses on the workflow of building such arrays in Python and packaging them into something we can listen to.