In Chapter 1, Audio Concepts, we discussed the most important concepts of digital audio theory. In particular, we saw that a simple array of numbers could represent an audio signal, and talked about topics such as PCM, sampling rate, bit depth, and multi-channel audio.
In this chapter, we will be putting all of those concepts into practice, so make sure you understand them before continuing. For starters, let us look into the meaning of audio data, both in theory and in code.
Audio data is nothing more than a sequence of numbers that represent the amplitude of a sound wave at even time intervals. However, there are many ways to represent numbers on a computer, depending on the amount of memory used to represent them, whether they should be able to store negative numbers, and whether the numbers are integers or floating point numbers. These differences result in the multiple data types provided by C++ to store numbers, such as int
, short
, float
, and double
. It makes...