Answers to Five Questions on DSP
By Will Pirkle
DSP stands for Digital Signal Processing. This theory uses a kind of digital-math to implement signal processing ideas such as EQ or delay
1. Why do I need to know DSP stuff if I want to write audio Plug-Ins?
Most Plug-Ins are based, at least in some part on DSP theory. When you want to write a Plug-In you almost always start out with a DSP algorithm, block diagram or transfer function. These will include some terminology and figures that are specific to DSP like equations full of z terms or figures showing blocks with z values. Generally, when you write Plug-Ins you will be implementing DSP algorithms, not designing them. Your job is to turn these into C++ code so you will want to know what they mean and how they operate on the signal. Basic DSP is actually surprisingly simple to grasp. And after you have worked with the building blocks, you will find that you can put them together in your own way to create lots of variations. For example, if you can make a Low Pass Filter Plug-In and a Delay Plug-In, you can figure out how to combine them and place the Low Pass Filter in the feedback path of the delay so that each successive echo looses more and more high frequencies and becomes degraded, sort of like an analog tape delay. So knowing the DSP stuff can help you think of your own cool Plug-In ideas.
2. Do I need to take Calculus to understand DSP for writing Plug-Ins?
Although it is usually a prerequisite in college, calculus is not actually not required to understand how DSP filters and algorithms work or how they are designed. In my book, I show you how to analyze a DSP filter with just addition and multiplication. In fact, if you pick up a DSP textbook, you won’t find very many derivatives or integral signs; maybe just a few. Calculus is the basis for analog signal processing since it is a continuous time treatment. In digital signal processing we use another kind of math that is discretized in time which means it deals with samples in time rather than analog values in continuous time. This takes the calculus (continuous) part out the equation, so to speak, along with the integrals and derivatives. You might find calculus in the derivation of some algorithms, or if you decide you want to learn more about how analog filters are converted into digital ones (beyond what I explain in my book) then you will might start seeing more calculus. Generally speaking, my experience is that calculus is for analog and complex Math is for DSP.
3. What is “complex math?”
Complex math is math that involves imaginary numbers. Don’t freak out or anything! Complex math and imaginary numbers are easy to deal with for our purposes. You probably had a class with imaginary numbers in high-school or maybe college. We only need to use a small portion of the overall math theory, though so it’s not a huge hurdle to cross. There are only four equations/relationships you have to know to make sense of the basic DSP theory and they’re all pretty simple – and there is no calculus.
4. Everybody talks about DSP like it’s Magic Art something. What’s up with that?
Let me preface this by saying that I came from an analog background, my first job was in analog, and I still teach two classes in analog audio circuits; its safe to say that I love analog. Prior to the 1980’s, audio signal processing was almost always done in analog with hardware like mixing boards, equalizers, compressors, and even synthesizers. The analog gear ranged from awesome (expensive) to really crappy (cheap) and in-between. You really had to spend a lot of money to get the best stuff. Much of this gear ages over time and will require servicing from time to time. When DSP started to become more commonplace around the early 1990’s people realized they could get some very high quality digital effects processors at reasonable prices. Though these were still hardware, they processed audio with DSP code, not analog circuits. So, you could get effects processors with hundreds of algorithms all in 1 rack-space rather than hundreds of rack spaces. And as time went on, the algorithms got better and bigger. Designers started doing things in DSP effects that would either be impossible or really difficult in analog like pitch shifting and time stretching. As Plug-Ins grew in popularity, we saw user interfaces (GUIs) that allowed much more flexibility than their hardware counterparts. For example you could bend and stretch EQ curves with the mouse (my FIR Plug-In lets you do something similar) or easily view layers of menus/lists or manipulate other graphic controls that don’t exist in hardware. Finally, DSP is a wide-open door as far as signal processing goes. The advancements and new algorithms just keep coming; if you have ever been to an Audio Engineering Society convention you have seen the rooms where papers are presented – some of these represent the latest things going on in DSP. A lot of people who with with DSP really feel like they can do just about anything with it and so that is were most of the Magic comes from. The other part is the assumption that DSP is difficult when in reality, the basic stuff is really not that hard to grasp.
5. How do I convert a DSP Transfer Function or Algorithm into C++ code?
First, you need to know the basic DSP theory I’ve been talking about so far. When you find (or think of) a DSP algorithm, you will usually be using a block diagram or transfer function to describe it. You need to turn these pieces into C++ code. The way you do that is one of the central threads in my book. You have to start off turning simple algorithms into code so you need examples to follow. And you need to progress through several different kinds of algorithms; for example filters and EQs are coded with one concept (filter structures) while delay-lines use another concept called circular buffering. Long FIR filters also use the circular buffering idea. Oscillators are a spin-off of the filter stuff while chorus/flanger/vibrato is a combination of oscillators and delay-lines. Reverb uses a collection of filter, delay and sometimes modulated delays. Modulated filters are a combination of oscillators and filters. Dynamics processors use detectors (filters) and gain computers (simple math). In my new book, I teach this thread by taking you through the sequence that I outlined above where each next chapter either introduces a new concept or combines existing concepts in order to teach a new type of processor. If you have been coding along with RackAFX (all the book code is available on my website) then by the end of the book you are left with a long list of Plug-Ins in your User Plug-Ins menu.
Visit Will Pirkle’s website for video tutorials and other resources that accompany Designing Audio Effect Plug-Ins in C++ – including the RackAFX(tm) Rapid Plug-In Development Lab – www.willpirkle.com
Will Pirkle is an Assistant Professor of Music Engineering Technology at the University of Miami Frost School of Music, where he teaches C++ audio programming, signal processing, audio synthesis, recording studio workshops, and mobile app programming. In addition to his nine years of teaching, Mr. Pirkle has twenty years of experience in the audio industry, during which he worked and consulted for companies including Korg Research and Development, SiriusXM Radio, Diamond Multimedia, Gibson Musical Instruments, and National Semiconductor Corporation. An avid guitarist and studio owner, Mr. Pirkle continues to seek projects that combine all his skills.