mmmerle


DSP Basics for Guitarists

Digital signal processing turns a guitar signal into a stream of numbers at a fixed sample rate, then rebuilds voltage from whatever those numbers become after your code runs. This chapter covers sampling rate, bit depth, buffer size, and the digital equivalents of the analog concepts already covered in Fundamentals — the vocabulary every later Digital chapter assumes.

Digital signal processing (DSP) is the practice of representing a signal as a sequence of numbers and manipulating those numbers instead of manipulating voltage directly. On a Daisy-based pedal, your guitar signal is converted into numbers at a fixed rate, run through your code, and converted back into voltage on the way out — every concept in this chapter exists because that conversion has to happen fast, precisely, and without losing the parts of the signal that matter musically.

Sampling rate: how often the signal gets measured

A sample rate of 48,000 Hz (a common Daisy Seed default) means the incoming voltage is measured and turned into a number 48,000 times every second. This connects directly to the flip-book idea introduced in the Electrosmith Daisy Guide: more frames per second means smoother apparent motion, and more samples per second means a more faithful digital reconstruction of the original continuous signal. There’s a hard rule governing exactly how faithful: the Nyquist theorem, which states a sampling rate can only accurately capture frequencies up to half of itself. At 48,000 Hz, the system can faithfully represent frequencies up to 24,000 Hz — comfortably above the roughly 20,000 Hz upper limit of human hearing, which is why that sample rate (and the similar 44,100 Hz used in CD audio) became a practical standard.

Aliasing: what happens when that rule gets broken

Feed a digital system a frequency higher than half its sample rate and it doesn’t just fail to capture that frequency — it misrepresents it as a different, lower, and often dissonant frequency that wasn’t actually present in the original signal. This is called aliasing, and it’s the digital-domain equivalent of a car wheel appearing to spin backward on video at certain speeds: the sampling rate is too slow relative to what’s being sampled, and the result is a false signal, not just a missing one. Effects that generate new high-frequency content internally — distortion and waveshaping effects especially — have to guard against aliasing deliberately, because the distortion process itself can create frequencies above the Nyquist limit even when the original guitar signal didn’t contain any.

Bit depth: how precisely each sample is measured

Where sample rate is how often a measurement happens, bit depth is how precise each individual measurement is. A 16-bit sample can represent 65,536 distinct voltage levels; a 24-bit sample can represent over 16 million. Lower bit depth doesn’t change pitch or timing the way a wrong sample rate does — it introduces quantization noise, an audible noise floor that gets more apparent at low signal levels, similar in effect to (though mechanically different from) hiss in an analog circuit with a poor signal-to-noise ratio.

Buffers: why audio is processed in chunks, not sample by sample

A Daisy-based effect doesn’t process one sample, send it out, then wait for the next one — it processes fixed-size blocks of samples, called buffers, handed to your code all at once by the audio callback (see coding effects with C++). A smaller buffer size means lower latency — less delay between a note being played and the effect’s output being heard — but demands your code finish processing each block faster, since a new one arrives sooner. A larger buffer size gives your code more breathing room per block at the cost of more perceptible latency. Every DSP effect design on the Daisy platform is implicitly working within this buffer-size tradeoff, whether or not it’s stated explicitly.

Translating analog concepts you already know into their digital equivalents

Analog concept (Fundamentals / Effects) Digital equivalent
Resistor-capacitor filter, shaping frequency response in hardware Digital filter algorithm (a small block of math applied to each sample)
Potentiometer setting a voltage or resistance A numeric value read from an analog-to-digital converter (ADC) into a variable
Capacitor storing charge over time An array or buffer storing past sample values
Diode clipping a voltage waveform A waveshaping function clipping or reshaping a numeric value

None of the underlying goals change between analog and digital — a low-pass filter still exists to remove high frequencies, clipping still exists to add harmonic distortion — only the mechanism does. That’s why resistors and capacitors and reading schematics are worth understanding even for a purely digital build: the mental models transfer directly, even though the implementation is code instead of components.

Common mistake: assuming “digital” means “perfect” or “free of constraints”

A common misconception is that moving to digital removes the tradeoffs analog builders deal with — noise, filtering artifacts, distortion character. It doesn’t remove them; it relocates them. Aliasing replaces the messier harmonic behavior of an overdriven analog stage, quantization noise replaces thermal and component noise, and buffer-size latency replaces the (much smaller, but real) propagation delay in an analog signal path. Every digital effect design decision covered in coding effects with C++ is, underneath, a tradeoff of exactly this kind — digital DSP isn’t an escape from constraints, it’s a different, code-shaped set of them.

From Other Books