Vector Synthesis — User Guide

Four-source vector synthesis using a 2-D control path and bilinear interpolation between SAW, SQR, TRI, and SIN corner sources. Single-note mode follows one path over one note; Melody demo keeps the vector path continuous across an eight-note sequence.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 0.5 (2026) License: MIT License Repo: Praat AudioTools
Contents:

What this does

The script generates sound from four phase-related oscillator families placed at the corners of a unit square. A point (X(t), Y(t)) moves through that square according to the selected path. Its position becomes four interpolation weights, and the weighted oscillator sum becomes the output.

Process:
2-D path → bilinear weights → SAW / SQR / TRI / SIN → weighted mono sum → note-edge fades → mean removal → target peak normalization

No input Sound is required. The vector controls timbre, not pitch: within each note all four corner sources use the same fundamental frequency.

Quick start

  1. Choose Single note or Melody demo.
  2. Select one of the twelve Path types.
  3. Set Path speed in cycles per second.
  4. For Single note, set Duration and Frequency.
  5. Enable Edit details if you need to change Sample rate, Output peak, or Show trail.
  6. Run the script. A mono Sound named VectorSynth or VectorSynth_Melody is created.

Vector space and bilinear weights

The four sources occupy the four corners of the interpolation square:

CornerCoordinateSource
A(0, 0)SAW
B(1, 0)SQR
C(0, 1)TRI
D(1, 1)SIN

At each sample the weights are:

wA = (1-X)(1-Y)
wB = X(1-Y)
wC = (1-X)Y
wD = XY

and the synthesized sample is:

output = wA·SAW + wB·SQR + wC·TRI + wD·SIN

For coordinates inside the unit square, the four weights are non-negative and always sum to 1. At a corner one source has weight 1; at the center all four weights are 0.25.

Corner sources

SourceCurrent implementation
A — SAWRising sawtooth with a polyBLEP correction at the wrap discontinuity.
B — SQR50% square wave with polyBLEP corrections at both discontinuities.
C — TRIDirect triangle formula 4·abs((phase mod 1)-0.5)-1. Its harmonics fall much faster than the saw/square spectrum, but it is not generated with a polyBLEP correction.
D — SINPure sine oscillator.

All four sources inside a note use the same fundamental frequency and local note time. Their phases are therefore deterministically related while they are blended.

v0.5 reduces discontinuity aliasing in the Saw and Square sources with polyBLEP. It does not use oversampling, and it is not accurate to describe every corner oscillator as perfectly band-limited.

Path types

Path speed is measured in cycles per second. The periodic paths use global path phase:

phase(t) = PathSpeed × t
PathActual v0.5 behavior
CircleX=.5+.4 cos(2πp), Y=.5+.4 sin(2πp).
EllipseCircle-like path with horizontal radius .45 and vertical radius .30.
Lissajous (3:2)X=.5+.4 sin(3·2πp), Y=.5+.4 sin(2·2πp). Because 3:2 is rational, the curve is periodic.
Figure-8X=.5+.4 sin(2πp), Y=.5+.4 sin(2·2πp).
Spiral InRadius decreases linearly from .45 to 0 over the complete piece duration.
Spiral OutRadius increases linearly from 0 to .45 over the complete piece duration.
Square PathContinuous motion along the four edges of the inner square from .1 to .9. It no longer jumps from corner to corner.
StarAngular rotation with a radial factor .5+.5 cos(10πp).
Infinity LoopRational lemniscate-like curve using denominator 1+sin²(2πp).
ButterflyDeterministic butterfly-like trigonometric/exponential curve, scaled to remain near the center of the square.
Rose CurvePolar-style radius cos(5·2πp), producing a five-fold rose trajectory.
Quasi-Chaotic CurveDeterministic incommensurate-looking trigonometric product using factors 3.7 and 2.3. It is not a dynamical-system attractor.

Path speed = 0

Zero is allowed. In that case the path remains at its analytical starting point for the complete note or melody, creating a static blend rather than motion.

Melody demo

Melody demo renders this fixed eight-note sequence:

E2 82.41 Hz 0.5 s
G2 98.00 Hz 0.5 s
A2 110.00 Hz 0.5 s
C3 130.81 Hz 0.7 s
A2 110.00 Hz 0.5 s
G2 98.00 Hz 0.5 s
E2 82.41 Hz 0.5 s
D2 73.42 Hz 0.9 s

Total duration is exactly 4.6 seconds.

Continuous vector motion

Version 0.5 passes each note's global offset into the path equations. Therefore the vector path does not restart at note boundaries. A circle, Lissajous path, Square Path, or other trajectory continues from the position reached by the previous note.

Local oscillator phase

The oscillator sources themselves use local note time, so oscillator phase restarts for each new note. Each note also receives a short fade-in and fade-out:

fade-in = min(5 ms, duration/4)
fade-out = min(10 ms, duration/4)

The fades are articulation fades; they do not alter the underlying global vector trajectory.

Controls

Main page

ControlDefaultMeaning
Synthesis modeSingle noteSingle user-defined note or fixed eight-note Melody demo.
Path typeCircleSelects one of twelve analytical 2-D trajectories.
Path speed.5 cycles/sGlobal vector-motion rate; zero is allowed.
Duration6.0 sSingle-note duration; ignored by Melody demo.
Frequency110 HzSingle-note fundamental; ignored by Melody demo.
Edit detailsoffOpens Sample rate, Output peak, and Show trail.
Draw visualizationonDraws the mechanism-first four-panel display.
Play resultonPlays the generated Sound.

Details page

ControlDefaultMeaning
Sample rate44100 HzDirect synthesis and final output rate; minimum accepted value is 2000 Hz.
Output peak.95Final target peak normalization; valid range >0…1.
Show trailonUses a time-gradient trajectory in Panel A; off uses one neutral trajectory color.

Sampling and safety

The script requires Sample rate ≥ 2000 Hz.

For Single note, and independently for every Melody-demo note, the fundamental must satisfy:

frequency < 0.45 × SampleRate

This protects the oscillator fundamental from approaching Nyquist. It is not a guarantee that every harmonic of the non-sinusoidal sources remains below Nyquist.

Saw and Square use polyBLEP to reduce discontinuity aliasing. Triangle has a faster-decaying harmonic series and is less alias-prone, but the generator has no oversampling or full harmonic truncation stage.

Output and level

PropertyBehavior
InputNo input Sound required.
ChannelsMono.
DurationSingle note: exactly Duration. Melody demo: exactly 4.6 s.
Sample rateExactly the Details-page Sample rate.
Note boundariesShort local fades; Melody demo concatenates the eight rendered notes directly.
DC handlingSubtract mean is applied to the complete final Sound before normalization.
NormalizationEvery non-silent final result is peak-scaled to Output peak. This is target normalization, not a down-only ceiling.
Object namesVectorSynth or VectorSynth_Melody.

Visualization and QC

PanelWhat it shows
A — Vector trajectoryThe selected path in the unit-square oscillator space, with A SAW, B SQR, C TRI, and D SIN at the four corners. Show trail optionally gives the trajectory a time gradient.
B — Bilinear source weightsThe four actual weight trajectories wA…wD over the complete output duration. In Melody demo, dotted vertical lines mark note boundaries and make the continuous global path explicit.
C — Corner source waveformsOne normalized period of the same four oscillator definitions used by the engine. Melody demo uses E2 (82.41 Hz) as the display frequency.
D — Measured outputThe complete final normalized waveform: either the single note or the full 4.6-second melody.

The QC strip reports path and speed, measured X/Y ranges, maximum error in the identity wA+wB+wC+wD=1, mean contribution of each corner source, and final peak/RMS.