Connect with us

Hi, what are you looking for?

Tweaks

Exploring Guitar Distortion Using Diodes in Code, Rather Than Hardware

Image source:Natalia Krasnova @ Shutterstock

Guitarists often seek the perfect sound for their setup and are willing to introduce intentional distortion into the signal to achieve it. While this may seem counterintuitive, when done correctly, it can work wonders. But have you ever wondered what exactly happens to the signal during distortion? And can it be simulated? The answer is yes, and it can be done with some basic math and Arduino code.

The Diode Clipping Circuit

One of the simplest techniques for modifying the signal from an electric guitar is the diode clipping circuit. This circuit involves using an op-amp with antiparallel diodes either in series in the feedback loop or shunting the output to ground. The diodes clip the tops and bottoms of the sine waves, transforming them into something closer to a square wave. This square wave adds extra harmonics and depth to the sound, resulting in the desired distortion effect. It is this straightforward technique that explains the wide availability of commercially available distortion pedals.

Simulating Distortion with Algorithms

In a video, [Sebastian] explains how distortion can also be simulated using algorithms. He breaks down the math behind it, which is surprisingly easy to understand. The algorithm consists of a step function with a linear part, a quadratic section, and a hard-clipping function. Additionally, [Sebastian] derives a second, more computationally efficient algorithm from the Schockley diode equation, taking advantage of a natural exponent step function. To implement these models, [Sebastian] chose an Arduino GIGA R1 WiFi, using an ADC to convert the guitar’s analog signal to digital and dedicating a DAC to each of the two algorithms. Each distortion effect has its unique qualities, appealing to different preferences. While some may prefer the harshness of the step function, others may gravitate towards the exponential algorithm.

Image credit: Natalia Krasnova @ Shutterstock

You May Also Like

Tweaks

Over the years, governments and politicians have attempted to implement internet censorship or surveillance measures in the name of protecting children. However, a proposed...

Tweaks

When it comes to defining a cyberdeck, there may be some debate. However, one thing is clear: a cyberdeck should have a battle-ready appearance....

Tweaks

We haven’t checked, but we’ll go out on a limb here and say this is the first project we’ve featured with a BOM that...

Tweaks

Researchers from Carnegie Mellon University have recently released a pre-print paper showcasing their latest system, MT-ACT: Multi-Task Action Chunking Transformer. The main purpose of...