Spectrum: 8192-point FFT, 0 to -100 dB, 20 Hz to 20 kHz
warped q, grey: unwarped phase
d = value / 4096 (800 gives d = 0.5)
Segments:
q = phase / d / 2 when phase < d
q = 0.5 + (phase - d) / (1 - d) / 2 otherwise
Power:
k = ln 0.5 / ln d (d 0 gives k 0, d 0.5 gives k 1, d 1 gives k infinity)
q = phase ^ k (0 ^ 0 = 1, so 000 holds q at 1)
s = 2 d - 1 (800 gives s = 0: no warp)
Kinkless:
q = phase - s (1 - cos 2 pi phase) / 2 pi
(dq/dphase = 1 - s sin 2 pi phase: smooth and
equal at both ends, so a sine stays kink-free;
the half-cycle point moves only to about 0.30-0.70)
Truncate:
q = phase (1 - s / 2) when s >= 0 (FFF: triangle becomes a rising saw)
q = -s / 2 + phase (1 + s / 2) when s < 0 (000: triangle becomes a falling saw)
Rounded:
q = Segments q averaged over a window of 1/64 cycle around phase
(corners become short curves: dq/dphase is
continuous, so a sine has no kinks; FFF still
gives a triangle a saw whose fall lasts 1/64 cycle)
output = wave(q)
SID pulse: high when (accumulator >> 12) >= value