Figuring out Audiotool Heisenberg PM function

Potasmic
The Pulv
Published in
5 min readAug 18, 2016

Heisenberg is a software synthesizer on Audiotool, an online digital audio workstation. It features a phase modulation matrix for 4 operators (oscillators) along with other common synthesizer modules (filter, ADSR envelopes, etc.)

Last year, Inavon published a track briefly demonstrating how he reverse-engineered the relation between the value being shown on the Heisenberg’s visual interface and the actual modulation index. This article will give visualizations to his demonstration as well as further explanations.

Sine Wave // f(x) = sin(t);

From Basics to Phase Modulation

Before jumping into Inavon’s demonstration, let’s first look at what phase modulation is. If you are familiar with the definition of phase modulation, please skip this section. Otherwise, I’ll try my best to explain it.

Let’s take a well-known periodic function, a sine signal, described as:
sin( 2π · t );

Let’s call “t” time (in seconds). If you’ve studied trigonometry, you’d know that a sine-wave completes its cycle every 2π. That means sin( 2π · 0 ) = 0 and also sin( 2π · 1 ) = 0. So, the defined signal completes 1 cycle every second! Instead of saying “1 cycle every second”, let’s say “hertz” — the measurement for frequency.

A 1Hz sine wave. // f(t) = sin( 2πt )

A phase of a signal determines how shifted the signal is, horizontally (x-axis). Phase is usually symbolized as ϕ (called phi). When we add ϕ with the input the sin function (we call the input, the argument), we are phase shifting the signal:
sin( 2π · t + ϕ );

The same 1Hz sine wave with phase shifting. Note that the graph’s x-boundaries are static. // f(t) = sin( 2πt + φ)

Now instead of defining a constant ϕ, we replace it with another signal, which depends on time. Because of this, we need a different method to better visualize the resulting signal. Since phase shifting means moving a signal on the horizontal axis, we can visualize this by placing the modulator signal perpendicular to the carrier signal and graph their intersection.

Let’s pick a modulator signal that’s twice the frequency of the carrier signal (the signal being modulated).
ϕ = π/3 · sin( 2 · 2π · t )
Carrier =
π/3 · sin( 2π · t )
Resulting =
π/3 · sin( 2π · t + ϕ ) = π/3 · sin( 2π · t + π/3 · sin( 2 · 2π · t ) )

Here’s how it’d look like. I chose π/3 because it would scale nicely with other signals.

A 2Hz sine wave phase-modulating a 1Hz sine wave. // f(t) = π/3 · sin( 2π · t + π/3 · sin( 2 · 2π · t ) )

Theπ/3you see after the plus sign is the amplitude of the modulating signal. This is also called the modulation index. It determines how much phase of the carrier signal will be modulated. If the modulation index is 0, no phase modulation happens.

Audiotool Heisenberg. Picture From: Audiotool Wiki

What Inavon did was basically figuring out the relation between the actual modulation index internally and the value being displayed on the Heisenberg. This was his method:

I set out to find the phase shift as a function of amount of modulation and value of modulator. I used the sawtooth down as the modulator because it is linear and starts at 1 and ends at -1, and a sine wave at 0 Hz as the carrier so that the phase is always (0 + phase shift). Note that there is an imperfection at the jump of the sawtooth wave because it’s band limited.

At modulation amount = 0, nothing is heard (no phase shift).

At modulation amount = 50, a sine wave is heard at the modulator’s frequency. This means that for every wave of the modulator, a wave of carrier is played. The carrier is shifted 1/2 wave at modulator = 1 and -1/2 wave at modulator = -1, or range [-π,π].

When the amount of modulation is 100, a sine wave is heard at 4 times the modulator’s frequency (carrier shift is 2 waves at modulator = 1, -2 waves at modulator = -1, or range [-4π,4π]).

“At modulation amount = 50”
Amount of       + Frequency 
Modulation | Ratio
+--------------------------------+
0 | 0 (Inaudible)
50 | 1
100 | 4
sqrt(3)*100/2 | 3
sqrt(2)*100/2 | 2

From the first three values, Inavon extrapolated the bolded values and it was correct, so he could be reasonably certain that: s = modulator*π*(2x/100)^2

where “s” is the phase shift in radians, “x” is the amount of modulation, and “modulator” is value of the modulator in [-1,1].

Why is this important?

It’s not. But knowing how much you modulate things can help you achieve cool stuff in Audiotool like making circle (or a square) to appear on the X/Y Oscilloscope.

We know that, the parametric equations for a circle would be:
Right: x = cos(t) = sin(t+π/2)
Left: y = sin(t)

Since π/2 is constant, we can use any waveform that starts at 1 or -1 (e.g., square). Now, we want the phase shift of π/2, so we plug that in the found equation:

s = modulator*π*(2x/100)^2
π/2 = 1 * π*(2x/100)^2 (replace variables)
0.5 = (2x/100)^2 (divide both side by π)
sqrt(0.5) = 2x/100
x = sqrt(0.5)*100/2 = 35.355…

Your final setup would look like this:

Play any note, and it would look like this on an X/Y Oscilloscope:

Too simple, eh? (Oscilloscope I used: https://github.com/kritzikratzi/Oscilloscope)

And that’s it.

My texts and graphics in this article are under CC0. The rest, to their respective licenses. K“P”N M126

--

--