sine shaper

Turns a phase, the steady 0-to-1 ramp from an oscillator or lfo, into a sine wave, and its cosine; with the phase bent on its way, it makes the bright, vocal tones of phase distortion.

The sine shaper node

In the menu: sources, then oscillators.

Inputs

The offset has a knob, which disappears when something is connected to its input.

Outputs

A phase coming in, and the three outputs it makes

What it does

Every oscillator and lfo keeps track of how far through its cycle it is: its phase, which climbs steadily from 0 to 1 and then starts again. Most of them give it out on a phase output. The sine shaper takes a phase like that and turns it into a sine wave, following it exactly: as long as the phase keeps climbing, the sine keeps going round, at the same speed.

On its own, that's no more than a sine oscillator. Its use comes from two things the sine oscillator can't do.

Waves that keep in step

Because it follows another node's phase, the sine shaper's wave stays exactly in step with that node, and its offset sets where in the cycle it sits. Its cosine output is always a quarter of a cycle ahead of its sine. So from a single lfo you can get two, three or more slow waves that move at the same speed but rise and fall at different moments, all locked together. Two waves a quarter of a cycle apart are said to be "in quadrature"; used to move two things at once (two filters' cutoffs, or the pan of one sound and the level of another), they go round together in a circle, one rising as the other is at its peak.

Bending the phase: phase distortion

The other use is to bend the phase on its way in. A steady ramp makes a pure sine; but if the ramp rises quickly at first and then slowly, the sine shaper hurries through the start of each cycle and dawdles through the end. The wave keeps the same pitch, since each cycle still takes the same time, but its shape changes: one part squeezed and steep, the rest stretched out. Steep parts mean harmonics, so the tone brightens, the more so the more the phase is bent.

A factor power node bends a phase nicely: it raises the phase to a power, which still goes from 0 to 1, but curves. Its B input sets the bend: 0.5 leaves the phase straight, and higher values bend it more.

The phase bent more and more by a factor power (top), and the sine shaper's wave from it (below)

In this synth, a sawtooth oscillator (silent; only its phase output is used) drives a factor power, and a slow triangle lfo sweeps the bend back and forth. Listen to the tone open up from a pure sine to a bright, nasal, slightly vocal sound and close again, with the pitch never moving:

A sawtooth's phase, bent by a factor power that a triangle lfo sweeps, into a sine shaper

Watch and listen: the bend sweeping (16 seconds, WebM video)


The bend can come from anything: an envelope, so each note starts bright and mellows like a filter sweep, or the note's velocity, so harder notes are brighter.

When you might use it

The sine shaper has no frequency or amplitude of its own: its speed comes from the phase, and its level is always full. For a quieter sound, follow its waveform output with an attenuation filter, as the synth above does.

For music nerds

Phase distortion

Phase distortion is Casio's: the CZ series of the mid-1980s (the CZ-101 and its brothers) made all their sounds this way, reading a sine wave through a bent phase, with an envelope ("DCW", digitally controlled wave) controlling how much it was bent. With a straight phase the CZ played a sine; as the DCW envelope opened, the bend grew and the tone brightened, much like an analogue filter opening, which let a cheap digital synth sound surprisingly analogue. Its characteristic sounds are glassy, nasal and vocal, with a resonance-like quality, rather than a filter's.

Here the bend is a power curve. Bending to the square root (B 0.75) takes the second harmonic to 10 dB below the fundamental, and the harmonics then fall about 9 dB per octave; bending to the fourth root (B 1) makes the second harmonic just 8 dB below, falling about 6.5 dB per octave, nearly as bright as a sawtooth. Since the output still swings the full −1 to 1, the brightening comes at the fundamental's expense: at the fourth root it's half as strong as the plain sine's (−6 dB), so it sounds a little thinner and buzzier, not just louder.

Aliasing

Unlike the band-limited oscillators, the sine shaper does nothing to keep a bent wave's harmonics below half the sample rate: it just works out the sine of whatever phase it's given. With a straight phase that's no problem, but a strongly bent wave has harmonics high enough to fold back as aliases on high notes: at the fourth root, a note at 1 kHz has its harmonics from the 23rd up, about 30 dB below the fundamental and falling, folding back to inharmonic pitches. For low and middle notes, or a gentler bend, it's clean enough to hear; on high notes, bend less, or accept a little grit.

For math nerds

The shaper is a memoryless function of its inputs, the phase p and offset o:

y = sin 2π(p + o), factor = ½ + ½ sin 2π(p + o), cosine = ½ + ½ cos 2π(p + o)

worked out in double precision each sample. Since sin is periodic, p + o needn't be kept within 0 to 1.

Phase distortion

The factor power raises A to the power 4^(1 − 2B), so with the phase p from a sawtooth oscillator, the output is

y = sin 2πp^e, e = 4^(1 − 2B)

For e < 1, y is continuous at the cycle's ends (p = 0 and 1 both give 0), but its slope there jumps: near p = 0 it rises as 2πp^e, with an infinite slope at the start of each cycle, and it ends with slope 2πe. A singularity like p^e makes harmonics fall as k^−(1+e), and the jump in slope as k^−2; with e = ¼ the first dominates, so the harmonics fall roughly as k^−1.25, about 7.5 dB per octave in the limit and a little less over the first few octaves. Measured from one cycle, at e = ½ and ¼:

The Casio CZ used a two-segment linear bend (fast up to a knee, slow after it) instead of a power, which gives a corner, and so harmonics falling as k^−2 at most; a power curve's singularity is brighter at the same fundamental. Any other bend, built from the arithmetic nodes, gives its own spectrum.

Back to Sources: oscillators
Node reference
Contents