A reverse delay plugin
This year I have been learning a lot more about mixing, and I started to get into DSP, as the nerdy part of my brain was curious about how it all works under the hood. I was a bit curious to see how easy it is to make an audio effects plugin, so I made a simple reverse delay. This is really just a learning exercise, because the plugin I’d really like to make already exists: Soundtoys Crystallizer.
I hadn’t done any C++ for years, so I first smashed through Bjarne Stroustrup’s “A Tour of C++”. I found C++ to be a bit more modern and approachable than I had expected, and I did appreciate a book that is targeted at programmers who are experienced in other languages (most C++ books I found were either aimed at beginner programmers or existing C++ experts). In the end though, I didn’t really need to apply much of what I learned from the book, because I developed the plugin using the JUCE framework, which has such an extensive API that you end up feeling like you’re learning JUCE rather than learning C++. The advantage of the framework is that it does most of the work in setting up a plugin for you – getting audio in and out, helping you set up a basic UI – so you can focus on actually messing about with the audio.
What I built in the end was actually quite simple (code here on Github). A delay plugin must be one of the simplest plugins you can write, not least because you don’t need to get into the gnarly maths than comes with a lot of DSP. You write the incoming audio into a circular buffer – basically an array that wraps around on itself, so you always have access to the most recent few seconds of audio – and then depending on the delay time and level set in the UI, read a section of that out in reverse and add it to the output buffer. You can also feed the signal back, so the delay keeps repeating.
Here is a short audio example, where we play the same melody through twice: first with the effect bypassed, and then with the effect included.
That is quite a nice effect, but it does also hint at two weaknesses of the plugin. First of all, the crossfade into the reversed audio needs to be smoother, so we can’t get clicks and bumps in the audio.
The second problem I think is more of a musical one. I think the reversed audio actually still sounds a little bit too similar to the original audio. I suspect the trick with delay effects might be to create a delay that is different enough to the original audio that you brain doesn’t confuse the delay with the original notes, but not so different that it clashes with the original signal. The most popular delay effects often saturate or EQ the delayed signal (or perhaps add wow and flutter, in the case of a tape delay), all of which help put a bit of sonic distance between the original and delayed signals.