How a wavefolder works: folding with diodes
A wavefolder turns a wave back on itself once it passes a threshold, instead of flattening it like a clipper. In this diode folder the turns come at 0.41 V, 1.58 V and 3.46 V in, so a louder note gets more folds and a brighter, shifting tone.
circuit Folder setting input: 5 V, from 0.1 V to 5 V setting output: 0.385 V, from 0.1 V to 2 V U2 gnd n b opamp Rn1 in n 10k Rn2 b n 10k U1 gnd m out opamp Ri in m 10k Rf out m 10k R1 b a 4.7k D1 a m 1N4148 D2 m a 1N4148 R2 in c 4.7k R3 c gnd 2k D3 c m 1N4148 D4 m c 1N4148 R4 b e 4.7k R5 e gnd 750 D5 e m 1N4148 D6 m e 1N4148endPress Play to see the wave after the circuit, at out.
What you're hearing
Clipping flattens; folding turns back. A clipper's output stops rising past its threshold: the tops go flat. A folder's output turns round and heads back down, as if the wave hit a mirror. Push further and it reaches the next threshold and turns again. So instead of a wave squashed into a square, you get extra bumps inside each cycle, and more of them the louder it goes. It's the sound of west coast synthesis, where a folder often does the shaping a filter would do elsewhere.
An op-amp adds currents. U1 is an inverting summing stage: whatever current flows into its minus input, it pushes out through Rf, so the output is −10 kΩ × that current. Chapter 3 explains how (the op-amp's two rules). The input feeds it through 10 kΩ, so on its own the output is the input upside down: a slope of −1. U2 makes b, an upside-down copy of the input, so the folding paths can add current in either direction.
Each diode path reverses the slope. Path A goes from b through 4.7 kΩ and a pair of diodes. Below its threshold the diodes pass almost nothing. Above it, they conduct, and the path adds current against the direct one, with a slope of 10 kΩ / 4.7 kΩ = 2.13. The output's slope goes from −1 to about +1: the wave turns back. Paths B and C do the same at higher thresholds, alternating direction. Each has its own divider, so its diodes see only part of the signal: 2 kΩ / 6.7 kΩ = 0.30 of it for path B, and 750 Ω / 5.45 kΩ = 0.14 for path C. With a silicon diode starting at about 0.42 V, that puts their thresholds near 0.42 V ÷ 0.30 = 1.4 V and 0.42 V ÷ 0.14 = 3.0 V in. The 4.7 kΩ in each path sets how sharply it turns; its divider sets where.
The turns, in numbers. The soft diode knees put the actual turns a little later:
| input | output |
|---|---|
| 0.2 V | −0.20 V (still the clean slope) |
| 0.41 V | −0.32 V (first turn) |
| 0.91 V | 0 V (folded back through zero) |
| 1.58 V | +0.37 V (second turn) |
| 2.47 V | 0 V |
| 3.46 V | −0.36 V (third turn) |
| 4.48 V | 0 V |
| 5 V | +0.35 V |
From 0 V to 5 V in, the output never leaves ±0.37 V. At 5 V, each half of the sine passes all three turns on the way up and again on the way down, so the output changes direction seven times in each half-cycle, where the clean wave changes once. Past 5 V, there's no fourth path, so the output starts to grow again: that's where the input knob stops.
Why the harmonics rise and fall. More turns in each cycle means more energy in higher harmonics. But where the peak of the wave lands among the turns changes which harmonics are strongest. As the input rises, the harmonics take turns: the note's own frequency drops nearly out at about 1, 3 and 5 V in and comes back between, and the strongest overtone swaps between the 3rd and the 5th, with the 5th on top at full input. Single harmonics drop out and come back. Turning input up doesn't just add more of the same buzz, as a clipper does: the tone sweeps and shimmers. For a smooth, sine-shaped folder, the maths is exact: each harmonic's level follows a Bessel function of the drive, rising, peaking and falling back in turn. Both halves fold alike, so only odd harmonics appear.
The clipper, from the same parts. The third button makes path A's resistor 10 kΩ and takes paths B and C out. Now path A's slope, 10 kΩ / 10 kΩ = 1, cancels the direct path's −1 instead of reversing it. The output goes flat at about −0.45 V at 1 V in, creeping to −0.55 V at 5 V. Its harmonics grow with the input, each weaker than the one below it. The folder's don't: they swap places.
Try this
- On "Three folds", turn input slowly from 0.1 V to 5 V and watch the Scope. Below about 0.4 V it's a clean sine. Then the tops dent, and split into more and more wiggles: two more for each turn the peak passes.
- Listen while you turn it. The pitch stays put, but the tone sweeps as harmonics come and go. That moving tone is what folding gives you over clipping.
- Switch to "Clip, no fold" and turn input the same way. The tops just flatten, and the tone only gets buzzier.
- Open it in SynthMaker to change the parts. Make R1 3.3k for a steeper first fold, or put a
#in front of R4 to see what happens past the second fold without path C.
The parts list
circuit Folder setting input: 5 V, from 0.1 V to 5 V setting output: 0.385 V, from 0.1 V to 2 V U2 gnd n b opamp Rn1 in n 10k Rn2 b n 10k U1 gnd m out opamp Ri in m 10k Rf out m 10k R1 b a 4.7k D1 a m 1N4148 D2 m a 1N4148 R2 in c 4.7k R3 c gnd 2k D3 c m 1N4148 D4 m c 1N4148 R4 b e 4.7k R5 e gnd 750 D5 e m 1N4148 D6 m e 1N4148endThis is the three-fold version. "One fold" is the same list with input at 1.2 V. "Clip, no fold" makes R1 10k and puts a # at the start of R2's and R4's lines.
How we checked it
Checked against ngspice, a standard circuit simulator: the whole circuit, driven by a 1 kHz sine, is within 0.12% of ngspice across the audible band at the 2× rate it runs at, at every input level and in its clipping version.
Build it step by step
- The lesson: A distortion pedal from six parts (opens in a new tab). Ned builds a diode circuit part by part: the same diode knee that this folder uses three times over.
- The video: This distortion pedal is six lines of text: a real circuit, simulated. It loads only when tapped.
Further reading
- Shaping a simple tone into a complex one, of which folding is a kind: Wikipedia: Waveshaper.
- Why a sine through a sine-shaped folder gives Bessel-function harmonics: Wikipedia: Jacobi–Anger expansion.
- The op-amp stage that adds currents: Wikipedia: Operational amplifier applications (its summing amplifier).
- The diode model (Shockley's equation, as SPICE uses it): ngspice documentation.