Skip to main content

Chip Fuzzing Synthesis

I'm unsure whether I read about this or dreamt it (this year has been a blur) but I recall someone fuzzing a retro sound chip, most likely the Yamaha OPL3, by sending it random bits for its synthesis parameters and recording the output. Drawing from this, we can explore "chip fuzzing synthesis," the art of feeding total digital randomness into a synthesis algorithm and seeing what comes out.

There is no specific need for a real retro sound chip or even an accurate emulation of one, but it helps to understand how some old sound chips operate to look for inspiration. As an example, we can look at the Commodore 64's SID. This chip is an analog subtractive synthesizer, providing three oscillators with frequency inputs, waveform selection (saw, pulse, triangle, noise), and ADSR envelope generators, all mixed into a filter with controllable cutoff and (famously nonfunctioning) resonance.

The parameters of the SID are controlled by an internal set of 32 8-bit registers, which are written to using a 5-bit parallel address bus and an 8-bit parallel data bus. In C-like pseudocode, communication with the SID can be emulated like so:

char sidRegisters[32];

// Parallel ports used to communicate with SID.
char addressBus = 0;
char dataBus = 0;

void writeSid(char address, char value)
{
    addressBus = address & 31;
    dataBus = value;
    sidRegisters[addressBus] = dataBus;
}

The SID interprets the sidRegisters array and maps various bits and bytes to analog synth parameters. For example, registers 0 and 1, taken as a 16-bit integer, control the frequency of an oscillator, and register 4 selects the waveform and allows enabling ring modulation and hard sync.

Fuzzing the address and data buses is the equivalent of calling writeSid repeatedly with randomized address and value, writing random data to random registers. The exact rate at which random data is written is up to you. I find that slow randomization produces the most coherent results and has the least chance of turning the output into white noise. A few hundred times a second is a good start.

It also suffices to take a simpler route and feed high-frequency random noise (sample-and-hold, maybe) into every parameter of a synth. Again, we don't need a vintage emulation at all -- a minimal subtractive monosynth with waveform selection, ADSR envelope, and a few switchable filter types is adequate to get glitchy sounds. So here's a little patch:

This is sonically uncompromising (and hey, maybe that's your thing), but still makes a useful raw source for more polished sound design. Here's the same patch as above with some minor modifications and a lot of post-effects like granulators, distortion, and reverb:

The outcome of chip fuzzing synthesis is highly dependent on the choice of synthesis algorithm, the set of parameters, and the ranges for said parameters. I can imagine fuzzing FM, subtractive, additive, physical modelling, and parameters of an effects chain. The more inputs to fuzz, the better -- especially inputs that switch features on and off, exhibit complex interactions with other inputs, and/or unearth bugs and artifacts.

P.S. Watch this space, something fun is in the works...

Low Battery Audio Effects

Searching YouTube for videos of low battery toys and keyboards brings up results like "Demon Possessed Singing Trout." Please watch the video before proceeding.

I have a limited understanding of electronics, but a compulsory need to explain this phenomenon due to tech blogger ego syndrome. A low battery has an abnormally high internal resistance, causing its voltage to sag in response to the loads it's supporting. If it's powering multiple things, they will interact in strange ways. The distorted audio from the singing fish sounds like the clock rate is dropping in reaction to the load of the speaker. (The servo motors might also be causing voltage sag, although it isn't entirely clear from the video.)

The speaker/clock interaction is interesting since it works in a feedback loop: the clock controls the playback rate, and the amplitude of the output audio draws current that affects the clock. This inspires a general method for turning an audio algorithm into a "low battery" version:

  • Run a DSP algorithm such as sample playback, synthesizer, effect, etc. that can be operated at a variable clock rate.

  • Apply filters like a full-wave rectifier, envelope follower, or simple lowpass to simulate speaker load. Optional.

  • Apply a highpass filter to block dc. (This helps prevent the algorithm from getting stuck.)

  • Use this signal to control the clock rate of the DSP algorithm, so that a signal of higher amplitude lowers the clock rate.

The casual experiments I've done with this are promising. At subtle settings, this creates wandering, droopy pitch bends. Pushed to the extreme, it produces squelchy signal-dependent distortion. I especially like its effect on percussive signals, where louder transients are stretched out and any rhythmic pulse becomes irregular. I'm imagining software plugins that emulate digital hardware could be augmented with a "battery" knob that lets the user control how much the clock rate sags in response to the output signal.

An Analog-Style Frequency Shifter

In this post, I will give an overview of a well-known method for designing frequency shifter effects in analog electronics, and some notes on implementing a digital version.

Frequency shifting is a special case of single sideband (SSB) modulation, a device often used in radio electronics. SSB in telecommunications involves shifting audio frequencies by e.g. 10 MHz so they can be transmitted as radio waves, then shifting down 10 MHz at the receiver. For this reason, SSB is well-studied, and there are a few different ways to implement it. This post describes a design that has found use in electronic music applications, where the shift is small (up to ±20 kHz, and often in tiny shifts like 1 Hz). Wikipedia calls it a "Hartley modulator," but I can't find any source to corroborate that terminology.

A fantastic reference to look at for the design of an analog frequency shifter is [Haible1996], which provides a full set of schematics of a high-quality real-world analog unit. I'll only provide details up to an abstract block diagram that can be easily digitized.

This post starts off pretty theoretical, with an attempt to explain how the frequency shifter works. Admittedly, this is an explanation more for myself than it is for others, but I hope it helps. If not, feel free to skip the first two sections and check out the following links which might explain it better: [Smith2007] [Boschen2016] [Boschen2020]

Read more…

Exploring Modal Synthesis

Modal synthesis is simple in theory: a method of synthesizing sound where an excitation signal is fed into a parallel bank of resonators [Bilbao2006]. Each resonator, known as a "mode," has the impulse response of an exponentially decaying sine wave and has three parameters: frequency, amplitude, and decay time. It's a powerful method that excels in particular for pitched percussion like bells and mallet instruments.

Despite its conceptual simplicity, modal synthesis has a daunting number of parameters to tune -- three times the number of modes, to be exact -- and setting them by hand isn't practical or musically expressive. How are we supposed to get great sound design when we have so many degrees of freedom? In interface design parlance, what we want is a divergent mapping [Rovan1997] that takes a small number of controls, maybe four knobs, and maps them to the several dozen frequencies, amplitudes, and decay times that control the modal synthesizer.

While it is possible to reverse engineer modes from a recorded sample (see [Ren2012] for a particularly impressive application), I'm most interested in "parametric" modal synthesis where each model derives from mathematical formulas that allow the user to navigate around a multidimensional space of timbres. I found a number of such algorithms while shopping around the literature from both computer music and mechanical engineering, so I decided to summarize them in a concise reference for sound designers and composers.

Read more…

First Post

Welcome to my blog. This blog will have quality content, and that's a guarantee.