how wavefolding, phase modulation, frequency modulation, and high school math are all related
I. This is not a trig class
This is the famous sine wave — a mathematical function.
If x increases steadily forever, the wave goes on forever. But because it cycles so predictably as x increases or decreases, you can just cycle x from -1 to +1 and nobody will notice. What does that look like?
A sawtooth wave! (Minus the vertical lines we usually draw in.) And because a sine wave is symmetrical forwards and backwards, it doesn’t matter if the ramp is going the other way — or if you use a triangle wave instead. But let’s stick with the sawtooth for now, so the next bit isn’t a lie.
Let’s call x “phase”, because that’s what it is. The values -1 to 1 here represent -180 to +180 degrees, or -pi to +pi radians (whatever a radian is, I was a business major) or however many volts your synthesizer expects, etc.
II. PM is FM, FM is PM, more or less
Maybe you’ve seen internet discussions / knife fights about whether the Yamaha DX7 was really an FM synth, or if phase modulation sounds different from frequency modulation. It’s all just mathematical trickery, though, at least if talking about linear FM.
Imagine a wave as a circle, or perhaps the Circus Maximus. We’re in a chariot… no, a go-kart.
Let’s say our current phase is represented by the position around the track. The starting line is at 0 degrees, the finish line is 360 degrees but of course that’s also the starting line. Like our sawtooth wave above, it has a reset point that kinda doesn’t matter.
We go around one lap every minute — so our frequency is 1. This frequency makes our phase keep increasing (and resetting at the finish line). If we increase our frequency, our phase goes up faster. Oh hey, frequency modulation is phase modulation!
Now let’s complicate things.
On our go-kart is a metronome, turned so the arm swings in the same direction as the front-rear axis. And on the end of the metronome arm is a novelty pencil eraser shaped like a banana.
Now, let’s say our phase is defined by the position of the banana around the track. And let’s modulate our phase by setting the metronome into motion. So we have this constant forward motion from the go-kart engine, and a small back-and-forth wobble from the metronome.
Effectively, while the metronome/banana swings forward, the frequency of the banana increases. When it swings backward, the frequency of the banana decreases.
Phase modulation is frequency modulation!
(*) Okay. Technically, there is a difference — my understanding of calculus is almost nonexistent, but let’s put it this way: frequency represents the rate of change of phase. If you modulate phase with an upward ramp, frequency steps up by a steady amount; if you modulate phase with a downward ramp, frequency steps down by a steady amount. So a triangle wave modulating phase is the same as a square wave modulating frequency. A *sine* modulating phase or frequency is the same shape, though.
III. Where were we again? Phase modulation and sine shaping.
Okay. An important clue with the banana-metronome-kart story was that two things were adding to the phase. If we go back to the math, what if we said:
y = sin ( (pi * x) + m)
Where x is this thing that’s always increasing over time, and m stands for “metronome”, or rather modulation. Phase modulation.
But let’s go away from the math and get into synths. I’ve got this nice triangle oscillator, and I feed it into a sine function, and I get a sine wave out. Very nice.
What if I have another triangle oscillator, let’s say at twice the frequency, and I mix it with the main oscillator before going into the sine function? Phase modulation, that’s what.
Another import lesson of the banana is that the modulator has to slope both up and down — adding a sawtooth to another sawtooth would be like sticking a second engine on your go-kart and making it go steadily faster. (Or slower, if you hook it up backwards.)
IV. …and wavefolding?
Let’s feed this sine shaper with a sine wave and see what happens.
Boring! But… what if we crank up the gain? All we have to do is multiply our x value. (Note again: this works because it isn’t a saw.)
It’s starting to saturate. More?
Yes.
Oh yes.
V. This is the really real world, there ain’t no sine shaper!
Yes there are.
- Doepfer A-184-2 has a triangle-to-sine shaper, and while I haven’t tried it, I expect it will probably work.
- WMD Geiger Counter, Richter Megawave, Piston Honda, and the Sample Scanner unit in the ER-301 can all do exactly this. The input level is crucial if you want to catch the whole wave while also not going crazy-deep into wavefolding by accident.
- If you have a regular analog wavefolder, or Warps or something, go ahead and try the dual triangle phase modulation thing even if it doesn’t convert triangles to accurate sines (*). It still works pretty well! Antimatter Audio Crossfold even mentions thru-zero FM on its web page, and has a handy mix/crossfade input.
- This whole technique I’ve been describing is exactly what HappyNerding FM Aid and the WOMS Sinulator are all about. They’re set up in a way where you don’t really have to think much about it. (That Sinulator web page is how I finally put the pieces of this together.)
- If you have a VCO that supports phase modulation or thru-zero FM that will also drop down to really low LFO rates — zero frequency would be ideal, but take what you can get — you can use that as a (possibly slightly weird) sine shaper. Phase modulation may or may not be deep enough to get great wavefolding, but TZFM should get there. Here’s an example where I used one of the E370’s four VCOs in this way:
VI. Non-sine wavefolding?
There are other ways to wavefold, of course. Analog folders tend to use diodes in their design, and they often have several stages in series for a more complex sound. This study shows the transfer function of Lockhart and Serge wavefolders — not sines, but you can see the resemblance. To me, this tends to sound a little more satisfying than sine shaping if you use it for wavefolding.
Digital wavefolders, as in the E352 and E370, sometimes literally just fold the signal over upside down. Hey, it works.
Chebyshev Polynomials are another way to go. I haven’t experimented with this much except for trying it in Warps Parasite.
That same link mentions “table-based waveshapers,” as in the Geiger Counter etc. above. I drew a rough approximation of the Serge curve and used that in the ER-301 Sample Scanner and it worked nicely.
VII. Non-sine… phase modulation?
Aside from literally modifying the phase of an oscillator from the oscillator’s phase input, there are one and a half more options:
- Use a short delay, no feedback, and modulate the time on it just a tiny amount.
- Filter FM. Filters affect phase as well as amplitude. How well this works is going to vary a whole lot with the character of the filter, resonance, etc. It’s definitely worth trying with any filters you have.