– Guest blog by Audio Dev Academy
If you have taken an interest in programming audio plugins, there is one key concept you need to wrap your head around as soon as possible: how an audio waveform is represented digitally. Only then, you can start manipulating digital waveforms in meaningful ways, creating different creative audio effects. If you’ve read the three mini blogs before this one, about sound, samplerate and bit depth, you should be well on your way. You know that complex sound can be represented by a single movement, like that of an eardrum or speaker cone. And also, that once sound is digitized, its samplerate tells you the number of values that are used to represent one second of audio, and its bitrate tells you the precision of these values. Now, with that in mind, let’s take a look at the practical side of things: how to deal with these digital audio waveforms.
In code, an audio file is just a list of numbers, that represents the amplitude of a waveform over time. Usually these numbers have values between 1.0 and -1.0, with the value 0.0 as the middle. If you would plot all the values over time, and connect the dots, you would be able to see the actual waveform, just like in a DAW. Going back to our speaker cone analogy, you can view a 0.0 value as the speaker cone being at rest, and the amplitude values 1.0 and -1.0 as the speaker cone moved all the way forward and backward. Imagine the speaker cone moving with the audio sample values changing over time, and try to unify this with the visualisation of a waveform. This is what digitized sound is. Nothing more.
When programming an audio plugin, you need to consider that audio plugins are used in real-time. Meaning that an audio plugin does not have knowledge beforehand, of the audio it will receive for processing. In that regard, I’d like to think of an audio plugin as an assembly line worker, that gets handed one audio value between 1.0 and -1.0 at the time to process. The assembly worker has a toolset to process the audio values one at the time, and can use his knowledge over past audio values to his advantage. However, he never knows the value of the next value to come. A real-world example would be to multiply every audio value by 0.5, which would reduce the amplitude of the total wave by half, which would result in the same waveform but with reduced volume.
Changing the volume of a digital waveform but multiplying each audio value in the waveform by 0.5 might be a very simple operation, but it very accurately illustrates the concept of manipulating audio on a mathematical level. Building upon the principle of manipulating these audio values on by one, you will be able to create a wide variety of interesting audio effects used in music production. In future mini blogs, I’ll explain how several of these algorithms work, like filters, compressors and reverbs and such, but from a high level. Hang in there!
Audio Dev Academy is an exciting online environment for like-minded programmers, musicians and audio engineers who want to learn how to code audio plug-ins and virtual instruments – to be launched in 2019. In preparation for the launch, Audio Dev Academy will publish a series of blogs and ebooks about programming and the inner workings of audio plug-ins and virtual instruments. If you want to know more, find Audio Dev Academy on Facebook.