Complex Nonlinearities Episode 0: Why?

Jatin Chowdhury
6 min readSep 20, 2019

This article is meant to be the first in a series discussing complex nonlinearities in audio signal processing. I’d like to take a moment to discuss why I think this is a topic worth writing about.

Why Do We Need Nonlinear Signal Processing?

In many areas of signal processing we care almost exclusively about linear systems, because linear systems have some very nice properties that make them relatively easy to deal with. For instance, in wireless communications, we often try to make our systems as linear as possible, and those nice properties allow us to transmit multiple streams of data over a single channel split into various frequency bands, thereby facilitate the immense amount of data sent from cell phone to cell phone every day. However, in audio signal processing, we care first and foremost about how something sounds. And for better or worse, nonlinear systems can sound pretty cool.

In audio, we often refer to nonlinear signal processing generally as “distortion”, and this analogy represents the importance of nonlinear systems for audio, particularly music: what would our music be like today without distortion? Rock acts including the Kinks and Jimi Hendrix crafted their signature sounds from distortion. Lo-fi electronic and hip-hop producers depend on distortion for the character of their mixes. We need distortion to help our music sound interesting.

In the days of analog recording, distortion was something we often got for free. Amplifier and filter circuits, magnetic tape, and vinyl records all carried with them their own signature nonlinearities, that artists and engineers could use to craft their sounds. But in the digital world, systems are naturally linear, unless we choose to make them nonlinear.

Virtual Analog

Naturally, the first nonlinear digital audio systems were made as digital models of existing analog systems. This approach persists to this day in the world of virtual analog modelling. Complex nonlinearities often arise out of circuits, particularly circuits known for their distorting characteristics (e.g. guitar pedal circuits), and any digital model of such circuits will do its best to match that complex nonlinear behavior. The techniques for constructing nonlinear virtual analog systems have been well documented in research papers and journal articles for the Audio Engineering Society (AES), the Digital Audio Effects (DAFx) conference, and more.

Moving Beyong Virtual Analog

While virtual analog modelling has the ability to create interesting nonlinear systems, there are a few drawbacks. For one, the world of virtual analog is typically limited only to things that can be done in the analog world. One of the great things about digital audio is that the analog limits no longer exist, opening up a lot of possibilities for interesting sounds and systems that are often ignored or neglected when focusing on virtual analog modelling.

The other drawback of virtual analog is that it requires a background in the analog medium being modelled. For instance, if you wish to model an analog circuit, you need to have a strong understanding of circuit theory; if you want to model an analog tape machine, you need to understand electromagnetic physics. While these are wonderful fields, that I would encourage people to pursue if they are interested, it’s unreasonable to expect everyone who wants to do audio signal processing to learn some other field first.

Not Enough Indpendent Tools

For people wishing to make purely digital distortion effects today, the toolbox is fairly limited. The typical approach to creating digital distortion is to use a static nonlinear function, often an approximation of the sigmoid function.

Some properties of the sigmoid function, as well as some of the approximations that are typically used will be discussed below.

More…?

While static nonlinearities and sigmoid approximations are fine tools, they are somewhat limiting, with a somewhat predictable and tired sound (at least to my ears), especially when compared to the wealth of unique and sonically rich nonlinearities available in analog processing.

This brings us to the point of this series of articles: We need more tools. To that end each of the future articles in this series will be dedicated to a new nonlinearity that can be implemented in audio DSP systems. Each nonlinearity will have some interesting characteristic to it: maybe it exhibits interesting dynamic or stateful characteristics, maybe it has interesting parameterizable features, or maybe it just sounds cool in a way that I haven’t heard before. While the inspiration for the nonlinearity may come from the analog world, one should be able to understand and implement it with little no understanding of circuit theory or physics.

Starting Out

Since we’re going to be examining nonlinearities, I want to take a minute to examine the sigmoid function in more detail, to introduce some tools that we’ll be using to analyze future nonlinearities.

In particular, we’ll examine a sigmoid approximation known as the soft clipper. To implement a soft clipper, one would use the following equation:

This equation allows one to calculate the output f for any input sample x.

Static Curves

First let’s examine the “static curve” for this nonlinearity. The static curve plots the steady state output vs. input at various levels. The static curve for the soft clipper looks like this:

Frequency Response

If you’re familiar with signal processing, you are probably accustomed to looking at the frequency response of a system. For nonlinear systems, frequency response is a trickier beast. In the best case scenario, you can examine the frequency response of your system at a certain operating level. At worst, you may not be able to examine any frequency response of the system. The interested reader can find more information here.

Harmonic Response

Rather than frequency response, a tool that is often more for nonlinear systems is what I will call the “harmonic response” of the system. To find the harmonic response, we will give the system an input at a single frequency, say 100 Hz. For a linear system, the output will also only contain frequency content at 100 Hz. The 100 Hz component of the output may have a different amplitude or phase, but no other frequency content will be generated.

For nonlinear systems, on the other hand, a 100 Hz input can result in output signal at 100 Hz, 200 Hz, 300 Hz, any integer multiple of 100, known as the “harmonics” of the signal. Let’s examine the harmonic response of the soft clipper:

As you can see, the soft clipper gives output at 100 Hz, 300 Hz, 500 Hz, 700 Hz, etc; the odd harmonics of the signal.

For the more mathematically inclined reader, you may notice that the soft-clipping function is odd, hence why it generates odd harmonics. In particular, if a nonlinear function is approximated using a Taylor Series, the order of the function corresponds to the order of the generated harmonics. So for a 5-th order nonlinear function, harmonics up to the 5th harmonic will be generated. Note that for piecewise functions like the soft-clipper this fact does not necessarily hold, depending on discontinuities in the function’s high derivatives.

(Anti-)Aliasing

If you’ve worked with digital systems before, you may have guessed what’s coming next. Digital systems can only recreate a finite set of frequencies, any signal above a certain frequency will experience a phenomenon called “aliasing”. I won’t explain here in detail what aliasing is, but for audio signals lets assume that aliasing sounds bad, and is something we want to avoid.

A typical sampling rate for audio systems is 44.1 kHz (standard sampling rate for CDs). The maximum frequency that this sample rate can create is 22 kHz. So let’s say you’re applying soft clipping distortion to an audio signal that has frequency content up to 10 kHz. The soft clipper will generate odd harmonics, the first of which will be 30 kHz. 30 kHz is outside the range of frequencies that our sample rate can handle, so aliasing will occur.

The typical way to avoid aliasing is to run the nonlinear system at a higher sample rate. For soft clipping distortion, running at 4x or 8x oversampling is enough to mitigate most aliasing.

Finally…

In the next article, I’ll be discussing a new nonlinearity that is still fairly simple but contains deep parameterizations.

--

--