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

Recently, we explored the complexities surrounding timezones and the Moon’s unique timing system. While Earth’s time is Sun-based, the Moon follows a different rhythm...

Tweaks

In the past, high-voltage power supplies were common in households for tasks like electron acceleration and generating X-rays for television, but with the advancement...

Tweaks

Listening to music through USB sticks is a common practice, particularly in vehicles like [Folkert van Heusden]’s Opel Astra. However, factory-installed USB playback systems...

Tweaks

It’s common knowledge that Windows XP won’t run on a 386, or Windows 95 on an original IBM PC. However, with the latest releases...