15. Compression and MIDI

15. Compression and MIDI#

In Chapter 7, we studied how to convert analog sound into digital audio that is indistinguishable from the original to human ears. To accomplish this, we exploited two limitations of human hearing. We can only hear frequencies up to about \(20\) kHz, so a sample rate a bit above \(40\) kHz suffices. Additionally, we can only distinguish amplitudes across a dynamic range of about \(100\) dB in ordinary settings, so \(16\) bits per sample suffice. Through these mechanisms, we compressed analog sound, a continuous function with infinite resolution, down to a finite amount of information.

Are these the only limitations of our hearing? And if not, can we exploit the others to compress sound even further? In this chapter, we will study these questions. Along the way, we will learn how the audio formats we encounter every day (WAV, MP3, FLAC, and MIDI) store musical information, and why they make such different decisions about what to keep.

In this chapter, we will start by formalizing the goals of compression, through the lens of codecs. Next, we will study additional aspects of psychoacoustics, our perception of sound, that suggest new mechanisms for compression. After that, we will discuss lossy and lossless codecs for digital audio, which form the basis of formats like MP3 and FLAC, respectively. Finally, we will discuss the MIDI format, and its relationship to semantic compression.