Vector Synthesis — User Guide
Geometric sound generation: creates evolving timbres by interpolating between four oscillators along mathematical 2D paths, producing complex harmonic motion.
What this does
This script implements vector synthesis — a geometric approach to sound generation where timbre evolves by moving through a 2D space defined by four corner oscillators. A "vector" (point) travels along a mathematical path (circle, ellipse, Lissajous, spiral, etc.), and at each moment, the output sound is a bilinear interpolation between the four oscillator waveforms based on the vector's X,Y coordinates. This creates continuously changing harmonic spectra that follow geometric patterns.
Key Features:
- 12 Mathematical Paths — Circle, ellipse, Lissajous, figure‑8, spirals, square, star, infinity loop, butterfly, rose curve, chaotic attractor
- Four Oscillator Types — Sawtooth (NW), Square (NE), Triangle (SW), Sine (SE)
- Bilinear Interpolation — Smooth blending between oscillators based on vector position
- Melody Demo Mode — Plays a bassline sequence to demonstrate temporal evolution
- Advanced Visualization — Animated vector path with gradient trail effects
- Real‑time Parameter Control — Path speed, duration, frequency, visualization options
Technical Implementation: (1) Generate four oscillators: Create sawtooth, square, triangle, and sine waves at the target frequency. (2) Generate vector path: Create X and Y coordinate signals that follow the selected mathematical path over time. (3) Bilinear interpolation: At each sample, compute output = (1‑X)(1‑Y)×saw + X(1‑Y)×square + (1‑X)Y×triangle + X×Y×sine. (4) Melody mode: Concatenate multiple notes with the same path behavior. (5) Visualization: Draw the 2D vector space with oscillator corners and animated path.
Quick start
- In Praat, ensure no Sound objects are selected (or any selection will be ignored).
- Run script… →
vector_synthesis.praat. - For quick demo, check Melody_demo to hear an 8‑note bassline.
- Otherwise, choose a Path_type (start with "Circle" or "Lissajous (3:2)").
- Set Path_speed (0.1–2.0 Hz typical; cycles per second).
- Adjust Duration_s and Frequency_Hz for single‑note mode.
- Enable Draw_visualization and Show_trail for animated path.
- Click OK — the vector‑synthesized sound appears as "VectorSynth" or "VectorSynth_Melody".
Vector Synthesis Theory
The Vector Space Concept
2D Coordinate System
The synthesis space is defined as a unit square:
🧭 The Vector Path
The "vector" is a point (X(t), Y(t)) that moves through the space over time.
Its trajectory is defined by mathematical functions:
- Circle: X = 0.5 + 0.4×cos(2π×speed×t), Y = 0.5 + 0.4×sin(2π×speed×t)
- Lissajous: X = 0.5 + 0.4×sin(3×2π×speed×t), Y = 0.5 + 0.4×sin(2×2π×speed×t)
- Spiral: Radius decreases/increases over time while rotating
As the vector moves, it passes through different regions, emphasizing different oscillators.
Bilinear Interpolation
Four‑Corner Blending
For any point (X,Y), the output is computed as:
Why Bilinear?
Advantages over simpler blending:
- Smooth transitions: No abrupt changes when crossing boundaries
- Intuitive control: X and Y independently control horizontal/vertical blending
- Four‑way symmetry: Equal treatment of all oscillators
- Computational efficiency: Simple arithmetic operations per sample
Oscillator Generation
Waveform Formulas
📊 Four Classic Waveforms
Sawtooth (band‑limited):
Formula: 2 × (phase − floor(phase + 0.5))
Where: phase = frequency × time
Harmonics: All integer harmonics, amplitude ~1/n
Square (50% duty cycle):
Formula: if phase mod 1 < 0.5 then 1 else −1 fi
Harmonics: Odd harmonics only, amplitude ~1/n
Triangle:
Formula: 4 × abs((phase mod 1) − 0.5) − 1
Harmonics: Odd harmonics, amplitude ~1/n² (softer)
Sine:
Formula: sin(2π × frequency × time)
Harmonics: Only fundamental (pure tone)
Phase Calculation
All oscillators share the same frequency but different waveforms:
Path Mathematics
Parametric Equations
Each path type is defined by parametric equations X(θ), Y(θ):
Time Scaling
The path speed controls how fast θ advances:
Processing Pipeline
Path Types
12 Mathematical Paths
| Path | X(t) Formula | Y(t) Formula | Character |
|---|---|---|---|
| Circle | 0.5 + 0.4×cos(θ) | 0.5 + 0.4×sin(θ) | Smooth, periodic, equal time in all quadrants |
| Ellipse | 0.5 + 0.45×cos(θ) | 0.5 + 0.3×sin(θ) | Stretched horizontally, more saw‑square motion |
| Lissajous (3:2) | 0.5 + 0.4×sin(3θ) | 0.5 + 0.4×sin(2θ) | Complex, non‑repeating pattern (3:2 ratio) |
| Figure‑8 | 0.5 + 0.4×sin(θ) | 0.5 + 0.4×sin(4π×speed×t) | Symmetrical infinity symbol, crosses center twice |
| Spiral In | 0.5 + 0.45×(1‑t/d)×cos(θ) | 0.5 + 0.45×(1‑t/d)×sin(θ) | Starts at edges, converges to center |
| Spiral Out | 0.5 + 0.45×(t/d)×cos(θ) | 0.5 + 0.45×(t/d)×sin(θ) | Starts at center, expands to edges |
| Square Path | Corner switching | Corner switching | Jumps between corners, abrupt timbre changes |
| Star | 0.5 + 0.4×r×cos(θ) | 0.5 + 0.4×r×sin(θ) | 5‑pointed star pattern, rhythmic emphasis |
| Infinity Loop | 0.5 + 0.35×cos(θ)/(1+sin²(θ)) | 0.5 + 0.35×sin(θ)cos(θ)/(1+sin²(θ)) | True lemniscate (∞ symbol), mathematical |
| Butterfly | 0.5 + 0.35×sin(θ)×scale | 0.5 + 0.35×cos(θ)×scale | Complex butterfly curve, detailed pattern |
| Rose Curve | 0.5 + 0.4×cos(5θ)×cos(θ) | 0.5 + 0.4×cos(5θ)×sin(θ) | 5‑petaled rose, symmetric petals |
| Chaotic Attractor | 0.5 + 0.3×sin(θ)×cos(3.7θ) | 0.5 + 0.3×cos(θ)×sin(2.3θ) | Pseudo‑chaotic, never repeats exactly |
🔄 Path Deep Dive: Circle
Characteristics: Perfectly smooth, periodic motion. Equal time spent near each oscillator. Creates predictable, cyclic timbre evolution.
Musical use: Slow speeds (0.1–0.3 Hz) for gradual timbre sweeps; fast speeds (1–2 Hz) for rhythmic animation.
Visual pattern: Perfect circle centered at (0.5,0.5) with radius 0.4.
🎭 Path Deep Dive: Lissajous (3:2)
Characteristics: 3:2 frequency ratio creates complex, non‑repeating pattern (quasi‑periodic). Never exactly retraces itself within reasonable time spans.
Musical use: Evolving pads, soundscapes, or effects where repetition is undesirable. Sounds "alive" and unpredictable.
Visual pattern: Classic Lissajous figure with 3 lobes horizontally, 2 vertically.
🌀 Path Deep Dive: Spiral In
Characteristics: Starts at outer edges (strong oscillator character), spirals inward toward center (balanced blend). Creates "focusing" or "convergence" effect.
Musical use: Build‑ups, transitions, or sounds that start with strong identity and evolve into complex blends.
Visual pattern: Spiral that tightens toward center over time.
Path Selection Guide
🎯 Choosing the Right Path
For smooth, musical evolution: Circle, Ellipse, Rose Curve
For complex, non‑repeating textures: Lissajous, Chaotic Attractor, Butterfly
For dramatic structural changes: Spiral In/Out, Square Path
For symmetrical patterns: Figure‑8, Infinity Loop, Star
For mathematical curiosity: All paths — each has unique parametric equations
Oscillator Types
The Four Corner Oscillators
| Oscillator | Corner | Waveform | Harmonic Spectrum | Sonic Character |
|---|---|---|---|---|
| Sawtooth | Northwest (0,0) | Ramp wave | All harmonics: 1, 1/2, 1/3, 1/4, ... | Bright, rich, "analog synth" |
| Square | Northeast (1,0) | 50% pulse | Odd harmonics: 1, 1/3, 1/5, 1/7, ... | Hollow, woody, "video game" |
| Triangle | Southwest (0,1) | Linear slope | Odd harmonics: 1, 1/9, 1/25, ... (1/n²) | Mellow, soft, "flutey" |
| Sine | Southeast (1,1) | Pure tone | Fundamental only | Pure, simple, "tuning fork" |
Harmonic Blending Behavior
Spectral Evolution
From Sawtooth to Square: Even harmonics decrease, odd harmonics emphasized.
From Sawtooth to Triangle: All harmonics soften, higher harmonics attenuated more.
From Square to Sine: Odd harmonics decrease, approaching pure tone.
Through center (0.5,0.5): All four oscillators equally mixed = complex, evolving spectrum.
Example path: Circle at 0.5 Hz:
• Passes near Saw (bright) → Square (hollow) → Triangle (mellow) → Sine (pure) → back
• Creates continuous timbre cycle every 2 seconds
Phase Coherence
All oscillators are phase‑locked:
Oscillator Placement Rationale
🗺️ The Sonic Map
Horizontal axis (X): Brightness
Left (X=0): Sawtooth/Triangle (complex spectra)
Right (X=1): Square/Sine (simpler spectra)
Vertical axis (Y): Harmonic Density
Top (Y=0): Sawtooth/Square (many harmonics)
Bottom (Y=1): Triangle/Sine (fewer harmonics)
Thus:
NW (0,0): Sawtooth = bright + dense (maximum complexity)
NE (1,0): Square = simple + dense (odd‑harmonic richness)
SW (0,1): Triangle = bright + sparse (mellow complexity)
SE (1,1): Sine = simple + sparse (minimum complexity)
Parameters & Controls
Mode Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| Melody_demo | boolean | 0 | If checked, generates 8‑note bass melody (E2‑G2‑A2‑C3‑A2‑G2‑E2‑D2) instead of single note |
Vector Path Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| Path_type | option | Circle | Mathematical path: Circle, Ellipse, Lissajous, Figure‑8, Spiral In/Out, Square, Star, Infinity, Butterfly, Rose, Chaotic |
| Path_speed | positive | 0.5 | Speed of vector motion in cycles per second (0.05–5.0 typical) |
Single Note Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| Duration_s | positive | 6.0 | Duration of single note in seconds (0.1–30.0) |
| Frequency_Hz | positive | 110 | Fundamental frequency in Hz (20–2000 typical) |
Visualization Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| Draw_visualization | boolean | 1 | Draw vector space and animated path after generation |
| Show_trail | boolean | 1 | Show gradient color trail effect (blue→red over time) |
| Play_result | boolean | 1 | Play the generated sound automatically |
- Path_speed: 0.05–5.0 Hz. Below 0.1 = very slow evolution; above 2.0 = rapid changes.
- Duration_s: 0.1–30.0 s. Short durations (<1 s) may not complete full path cycles.
- Frequency_Hz: 20–2000 Hz. Lower frequencies (<100 Hz) highlight harmonic evolution; higher frequencies (>1000 Hz) may alias.
- Melody demo: Fixed bassline in E minor. Each note is 0.5 s except C3 (0.7 s) and D2 (0.9 s).
- Show_trail: Creates beautiful gradient visualization but uses more CPU. Disable for faster rendering.
Applications
Evolving Pad Synthesis
Use case: Create rich, continuously changing pads for ambient, electronic, or film music.
Technique: Use Lissajous (3:2) or Chaotic Attractor path with slow speed (0.1–0.3 Hz), low frequency (50–150 Hz), long duration (10–20 s).
Example: A 12‑second pad at 82 Hz (E2) with Lissajous path at 0.2 Hz creates a never‑repeating, evolving bed.
Sound Design & Effects
Use case: Generate unique sweeps, transitions, or animated textures for sound design.
Technique: Use Spiral In/Out for build‑ups/releases; Square Path for rhythmic gating; Butterfly for complex movements.
Workflow:
- Generate multiple instances with different paths
- Layer them in a DAW or Praat
- Apply additional processing (reverb, delay, filtering)
- Export as sound effects library
Algorithmic Composition
Use case: Create harmonically evolving sequences for generative music.
Technique: Use melody mode with different paths for each note, or script multiple calls with parameter variations.
Advantages:
- Mathematical control over timbre evolution
- Reproducible results (same parameters = same output)
- Can be automated via scripting loops
- Visual feedback of harmonic motion
Educational Demonstrations
Use case: Teach concepts of harmonics, waveforms, interpolation, and parametric equations.
Technique: Start with simple paths (Circle), show visualization, then demonstrate how X,Y coordinates blend waveforms.
Example: Compare Circle (smooth) vs Square Path (abrupt) to illustrate interpolation vs switching.
Practical Workflow Examples
🎹 Animated Synth Lead
Goal: Create a lead sound that evolves during sustained notes.
Settings:
- Path_type: Rose Curve
- Path_speed: 0.8 Hz (moderate evolution)
- Frequency_Hz: 440 Hz (A4)
- Duration_s: 2.0 s
- Melody_demo: No (single note)
Result: A lead tone that cycles through five distinct timbral "petals" during each note hold.
🌌 Ambient Soundscape
Goal: Generate 30 seconds of evolving ambient texture.
Settings:
- Path_type: Chaotic Attractor
- Path_speed: 0.15 Hz (very slow)
- Frequency_Hz: 65.41 Hz (C2)
- Duration_s: 30.0 s
- Post‑process: Add reverb in DAW
Result: A slowly shifting, never‑repeating drone suitable for film backgrounds or meditation music.
🎮 Video Game Sound Effects
Goal: Create retro‑style power‑up or transformation sounds.
Settings:
- Path_type: Spiral Out
- Path_speed: 1.5 Hz (fast)
- Frequency_Hz: 220 Hz (A3) rising to 440 Hz (modulate via script)
- Duration_s: 1.2 s
- Square Path for "digital" effects
Result: Animated synth effects with clear harmonic evolution, reminiscent of 80s/90s game audio.
Advanced Techniques
- Evolving speed: Create multiple sounds with increasing Path_speed, concatenate for acceleration effect.
- Frequency sweeps: Modify the script to change frequency_Hz during note generation.
- Path morphing: Generate with one path, then another, crossfade between them.
- Multi‑layer textures: Run script multiple times with different frequencies (harmonic series), mix results.
- Extreme slow: Path_speed = 0.05, Duration_s = 60 s = 3 cycles in one minute (glacial evolution).
- Audio rate modulation: Path_speed = 20 Hz (into audio range) creates complex sidebands.
- Infrasound: Frequency_Hz = 20 Hz (bottom of hearing) emphasizes timbre over pitch.
- Micro‑sound: Duration_s = 0.05 s with fast path = granular‑like events.
Troubleshooting Common Issues
Cause: Sawtooth/square waves have infinite harmonics; at high fundamental frequencies, harmonics exceed Nyquist.
Solution: Use lower frequencies (<1000 Hz); the script uses band‑limited formulas but not perfect.
Cause: Duration too short relative to Path_speed.
Solution: Ensure duration × speed ≥ 1 for at least one full cycle. Example: speed=0.5 needs duration≥2 s for one cycle.
Cause: Long duration with Show_trail enabled creates many drawing operations.
Solution: Disable Show_trail for durations >10 s; reduce Draw_visualization quality by modifying steps in procedure.
Cause: Path resets at each note boundary (each note starts at path beginning).
Solution: Modify script to continue path phase across notes, or use single‑note mode with manually created melodies.
Technical Deep Dive
Visualization Algorithm
Animated Path Drawing
1. Grid: Light gray dotted lines at 0.2 intervals
2. Boundary: Black square (0,0)–(1,1)
3. Corner markers: Colored circles with white centers and labels
4. Path: 800 segments connecting calculated points
5. Trail effect: Gradient from blue (past) to red (present)
6. Start marker: Green circle at beginning of path
With Show_trail: Each segment colored by its position in time (i/steps)
Without Show_trail: All segments red (0.9,0.1,0.3)
Coordinate Calculation
The getPathCoords procedure computes X,Y for any time t:
Optimization Strategies
Efficient Oscillator Generation
Praat's Formula is vectorized — entire sounds created with one expression:
Memory Management
Objects are removed immediately after use:
Mathematical Foundations
Bilinear Interpolation Derivation
Given four corner values A,B,C,D at (0,0), (1,0), (0,1), (1,1):