Guitar Distortion With Diodes In Code, Not Hardware

Guitarists will do just about anything to get just the right sound out of their setup, including purposely introducing all manner of distortion into the signal. It seems counter-intuitive, but it works, at least when it’s done right. But what exactly is going on with the signal? And is there a way to simulate it? Of course there is, and all it takes is a little math and some Arduino code.

Now, there are a lot of different techniques for modifying the signal from an electric guitar, but perhaps the simplest is the humble diode clipping circuit. It just uses 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 off of the sine waves, turning them into something closer to a square wave, adding those extra harmonics that really fatten the sound. It’s a simple hack that’s easy to implement in hardware, enough so that distortion pedals galore are commercially available.

In the video below, [Sebastian] explains that this distortion is also pretty easy to reproduce algorithmically. He breaks down the math behind this, which is actually pretty approachable — a step function with a linear part, a quadratic section, and a hard-clipping function. He also derives a second, natural exponent step function from the Schockley diode equation that is less computationally demanding. To implement these models, [Sebastian] chose an Arduino GIGA R1 WiFi, using an ADC to digitize the guitar signal and devoting a DAC to each of the two algorithms. Each distortion effect has its own charms; we prefer the harsher step function over the exponential algorithm, but different strokes.

Kudos to [Sebastian] for this easy-to-understand treatment of what could otherwise be a difficult subject to digest. We didn’t really expect that a guitar distortion pedal would lead down the rabbit hole to diode theory and digital signal processing, but we’re glad it did.

Continue reading “Guitar Distortion With Diodes In Code, Not Hardware”

An Effects Pedal For Keyboards (and Mice)

Effects pedals for musical instruments like electric guitars can really expand a musician’s range with the instrument. Adding things like distortion, echo, and reverb at the push of a button can really transform the sound of a guitar and add depth to a performance. But [Guy] wondered why these effects should be limited to analog signals such as those from musical instruments, and set about to apply a number of effects to the use of computer keyboards and mice with this HID effects pedal.

The mouse is perhaps the closer of the two to an analog device, so the translations from the effects pedal are somewhat intuitive. Reverb causes movements in the mouse to take a little bit of extra time before coming to a stop, which gives it the effect of “coasting”. Distortion can add randomness to the overall mouse movements, but it can also be turned down and even reversed, acting instead as a noise filter and smoothing out mouse movements. There’s also a looper, which can replay mouse movements indefinitely and a crossover, which allows the mouse to act as a keyboard.

For the keyboard, included effects are a tremolo, which modulates between upper- and lower-case at certain intervals; echo, which repeats keypresses; and a pitch-shift which outputs a “higher” character in the alphabet above whichever one has been pressed. Like the mouse, there’s also a crossover mode which allows the keyboard to be used as a mouse.

The device looks and feels like an effects pedal for a guitar would, with a RP2040 inside to intercept HID information, do the signal processing, and then output the result to the computer. And, while [Guy] admits this was a fun project with not many practical uses, there are a couple handy ones including potentially the distortion effect to smooth out mouse inputs for those with neuromuscular disorders or the mouse looper to act as a mouse jiggler for those with micromanaging employers. It’s also reprogrammable, and as we’ve seen since time immemorial having a programmable foot keyboard can be extremely handy for certain workflows.

Continue reading “An Effects Pedal For Keyboards (and Mice)”

Modeling A Guitar For Circuit Simulation

Guitar effects have come a long way from the jangly, unaltered sounds of the 1950s when rock and roll started picking up steam. Starting in large part with [Jimi Hendrix] in the 60s, the number of available effects available to guitarists snowballed in the following decades step-by-step with the burgeoning electronics industry. Now, there are tons of effects, from simple analog devices that would have been familiar to [Hendrix] to complex, far-reaching, digital effects available to anyone with a computer. Another thing available to modern guitarists is the ability to model these effects and guitars in circuit simulators, as [Iain] does.

[Ian] plays a Fender Stratocaster, but in order to build effects pedals and amplifiers for it with the exact desired sound, he needed a way to model its equivalent circuit. For a simple DC circuit, this isn’t too difficult since it just requires measuring the resistance, capacitance, and inductance of the overall circuit and can be done with something as simple as a multimeter. But for something with the wide frequency range of a guitar, a little bit more effort needs to go into creating an accurate model. [Iain] is using an Analog Discovery as a vector network analyzer to get all of the raw data he needs for the model before moving on to some in-depth calculations.

[Iain] takes us through all of the methods of figuring out the equivalent impedance of his guitar and its cabling using simple methods capable of being done largely by hand and more advanced techniques like finding numerical solutions. By analyzing the impedance of the pickup, tone and volume controls, and cable, this deep dive into the complexities of building an accurate equivalent circuit model for his guitar could be replicated by anyone else looking to build effects for their specific guitars. If you’re looking for a more digital solution, though, we’ve seen some impressive effects built using other tools unavailable to guitarists in days of yore, such as MIDI and the Raspberry Pi.

A Turing-Complete CPU In Sunvox? Why Not!

Day-time software engineer and part-time musician, [Logickin,] knows a thing or two about programming the SunVox modular synthesiser and tracker software. Whilst the software is normally used for creating music and sound effects, they decided to really push it, and create the VOXCOM-1610, a functional turing-complete CPU inside SunVox, just for fun.

For those who haven’t come across SunVox before now, this software is a highly programmable visual environment for building up custom synthesisers, piecing signals together to create rhythms — that’s the ‘tracker’ bit — as well as interfacing to input devices such as MIDI and many others. It does look like a lot of fun, but just like CPUs created in Minecraft, just because, this seems to be the first time someone has built one inside this particular music app. The VOXCOM 1610 is a fully functional 10 Hz, 16-bit computer. It boasts 2KB of ROM, 256 bytes of RAM (expandable to 128 KB), and 8 general registers for data exchange between components. If you don’t fancy manually poking bits into the ROM to enter your software, then you’re in luck as [Logickin] has provided an assembler (in Java) that should ease the process a lot. The ABI will look very familiar to anyone who’s ever touched assembler before, although as you’d expect, it is quite light on addressing modes.

Now, all that is needed is for someone to port Doom to this and we’ll have it all. We think that is unlikely to happen. For those who pay attention, we did see one neat SunVox project in the past, which is certainly eye-catching as well as eardrum-bursting.

Thanks to [elbien] for the tip!

GETMusic Uses Machine Learning To Generate Music, Understands Tracks

Music generation guided by machine learning can make great projects, but there’s not usually much apparent control over the results. The system makes what it makes, and it’s an achievement if the results are not obvious cacophony. But that’s all different with GETMusic which allows for a much more involved approach because it understands and is able to create music by tracks. Among other things, this means one can generate a basic rhythm and melody first, then add additional elements to those existing ones, leaving the previous elements unchanged.

GETMusic can make music from scratch, or guided from examples, and under the hood uses a diffusion-based approach similar to the method behind AI image generators like Stable Diffusion. We’ve previously covered how Stable Diffusion works, but instead of images the same basic principles are used to guide the model from random noise to useful tracks of music.

Just a few years ago we saw a neural network trained to generate Bach, and while it was capable of moments of brilliance, it didn’t produce uniformly-listenable output. GETMusic is on an entirely different level. The model and code are available online and there is a research paper to accompany it.

You can watch a video putting it through its paces just below the page break, and there are more videos on the project summary page.

Continue reading “GETMusic Uses Machine Learning To Generate Music, Understands Tracks”

RoboPianist Is A Simulation For Advancing Robotic Control

Researchers at Google have posed themselves an interesting problem to solve: mastering the piano. However, they’re not trying to teach themselves, but a pair of simulated anthropomorphic robotic hands instead. Enter RoboPianist.

The hope is that the RoboPianist platform can help benchmark “high-dimensional control, targeted at testing high spatial and temporal precision, coordination, and planning, all with an underactuated system frequently making-and-breaking contacts.”

If that all sounds like a bit much to follow, the basic gist is that playing the piano takes a ton of coordination and control. Doing it in a musical way requires both high speed and perfect timing, further upping the challenge. The team hopes that by developing control strategies that can master the piano, they will more broadly learn about techniques useful for two-handed, multi-fingered control. To that end, RoboPianist models a pair of robot hands with 22 actuators each, or 44 in total. Much like human hands, the robot hands are underactuated by design, meaning they have less actuators than their total degrees of freedom.

Continue reading “RoboPianist Is A Simulation For Advancing Robotic Control”

Building The Cheapest MIDI Home Studio From 1988

These days, there is a plethora of cheap hardware and software which you can use to make digital music. Back in the 1980s, though, this was still a nascent field, with new gear changing the game for musicians. In his latest video, [cTrix] puts together a guide to building a budget MIDI home studio like it’s 1988.

The original Atari ST is the star of the show, which sold for around £300 back then. Unlike most contemporary computers, it came with MIDI ports built-in, and it quickly became a popular platform for music sequencing and controlling external synth hardware. It was often spotted in posh studios being used by big-time musicians, but [cTrix] wanted to look at how it was used by more humble users.

While the Atari ST could output some passable chiptunes, it was most powerful when paired with off-board gear. Industry magazines would readily talk up “DIY” setups worth thousands, but [cTrix] aimed for a budget in the low hundreds. In 1988, that might get you something like the 16-channel Yamaha PSS-580, which rocked full MIDI support and a ton of sounds and drumkits built in. It ran an OPL soundchip, and could play multiple instruments at once under MIDI control from software like Dr. T’s MIDI Recording Studio.

Of course, if you’ve ever played a keyboard like the PSS-580, you’ll have noted that the sound output can be more than a little chintzy. A cheap way to level up was to get yourself something like the Roland MT-32, which rocked a far higher-quality sound module. Everything from slap bass to solid electric pianos could be blasted out from the Roland, which also included a decent reverb unit, too. [cTrix] also dives into other budget heroes, like the rich and expansive Kawai K1 and the Yamaha EMT-10.

If you want to make music like it’s 1988 and you’re hunting for your first gold record, you’ll learn a lot here. We can’t wait for Part 2, that explores the next level of sophistication in this era. His previous lessons on how to make 90s dance bangers on the Amiga are a treat, too.

Continue reading “Building The Cheapest MIDI Home Studio From 1988”