Phase Shaper — User Guide

Extreme convolution-based sound design: generates 10 radical impulse responses for transforming audio through convolution, creating effects from drones to glitches to spectral freezing.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 0.1 (2025) License: MIT License Repo: https://github.com/ShaiCohen-ops/Praat-plugin_AudioTools
Contents:

What this does

This script implements extreme convolution sound design — generating 10 unique impulse responses algorithmically and convolving them with audio to create radical transformations. Each mode creates a different character: from spectral freezing to bouncing ball effects, alien resonators to cyber glitches. Process: (1) Select audio input, (2) Choose transformation mode, (3) Script generates custom impulse response based on mathematical formulas, (4) Convolves input with impulse response, (5) Outputs transformed audio with extreme sound design effects.

Key Features:

What is convolution sound design? Traditional convolution: uses recorded impulse responses (IRs) of real spaces (rooms, halls) to add reverb. This script: generates synthetic, algorithmic IRs for creative effects. Mathematical formulas create IRs with specific spectral/temporal properties. Convolution then imposes these properties onto input audio. Result: input audio filtered through the IR's characteristics. Unlike EQ or filtering (static frequency response), convolution imposes the IR's complete time-frequency evolution onto the audio. Extreme IRs create extreme transformations: long noise IRs create spectral freezing, accelerating patterns create bouncing effects, modulated noise creates growls, etc. Each mode is essentially a different "sound design algorithm" expressed as an IR.

Technical Implementation: (1) Input preparation: Store original properties, convert stereo→mono if needed (convolution works on mono). (2) IR generation: Based on selected mode, creates Sound from formula with mathematical expression defining waveform. Different formulas create different effects: sine sweeps, noise patterns, modulated signals, etc. (3) Envelope shaping: Applies amplitude envelopes (fades, gates) to IR using Formula commands. (4) Convolution: Uses Praat's Convolve function with "sum" normalization and "zero" padding. (5) Output processing: Renames, scales peak to prevent clipping, optionally deletes original. (6) Cleanup: Removes temporary IR and mono conversion objects. Key insight: The IR is the "sound design algorithm" — its mathematical properties define the transformation.

Quick start

  1. In Praat, select exactly one Sound object.
  2. Run script…phase_shaper.praat.
  3. Choose Mode from 10 radical transformations.
  4. Adjust Intensity (default 1.0) — controls effect strength/duration.
  5. Set Scale_peak to prevent clipping (default 0.99).
  6. Choose whether to Keep_original sound.
  7. Click OK — IR generated and convolution applied.
  8. Output named "originalname_modeSuffix" appears in Objects window.
  9. Output automatically played if Play_result enabled.
Quick tip: Start with Bouncing Ball mode for clear, fun effect. Try Spectral Freeze for ambient/drone transformations. Use Cyber Glitch for digital/8-bit effects. Intensity controls different aspects per mode: IR duration, density, modulation rate, etc. Higher intensity = more extreme effect. For short sounds, use moderate intensity (0.5-2.0). For long sounds, try higher intensity (2.0-5.0). Enable Play_result to immediately hear transformation. Keep Keep_original enabled to preserve source material. Processing time depends on audio length and IR duration — Spectral Freeze with high intensity can be slow.
Important: CONVOLUTION IS COMPUTATIONALLY INTENSIVE — long IRs + long audio = slow processing. STEREO CONVERTED TO MONO for convolution, output is mono. EXTREME EFFECTS can completely destroy original audio character. INTENSITY INTERPRETATION VARIES by mode — read mode descriptions. CLIPPING RISK — convolution can create loud peaks, use Scale_peak < 1.0. SPECTRAL FREEZE with high intensity creates very long IRs → very slow processing. EXPERIMENTAL NATURE — results unpredictable, especially with complex source material. MEMORY USAGE can be high for long convolutions. Always PRESERVE ORIGINAL until satisfied with result.

Convolution Sound Design Theory

Convolution Fundamentals

What is Convolution?

Mathematical definition:

Given input signal x[n] and impulse response h[n]: Output y[n] = convolution(x, h) = Σ x[k]·h[n-k] k In words: each output sample = weighted sum of input samples, weights determined by time-reversed impulse response Frequency domain interpretation: Y(f) = X(f)·H(f) Output spectrum = Input spectrum × IR spectrum Output inherits spectral characteristics of IR Time domain interpretation: Output = input filtered through IR's time evolution IR acts as "template" imposed on input

Creative Convolution vs Traditional

Traditional convolution (reverb):

Creative convolution (this script):

IR Generation Mathematics

Praat's Create Sound from Formula

Formula syntax for IR generation:

Create Sound from formula: name, channel, start, end, sampleRate, formula Variables available in formula: x = time in seconds col = sample number (if matrix) row = channel number (if matrix) self = current value (in Formula command) Common functions: sin(), cos(), tan() - trigonometric exp(), log() - exponential/logarithmic randomGauss(mean, stdev) - Gaussian noise round() - nearest integer if condition then value1 else value2 fi - conditional Example (sine sweep): "sin(2*3.14 * (50 + 1000*x) * x)" Frequency sweeps from 50 to 1050 Hz over duration

Envelope Shaping

Applying amplitude envelopes to IR:

Common envelope techniques in script:

1. Linear fade-out:
Formula: "self * (1 - x/duration)"
Creates smooth decay to zero

2. Exponential decay:
Formula: "self * exp(-rate * x)"
Natural decay, faster initially

3. Exponential rise (reverse decay):
Formula: "self * exp(rate * (x - duration))"
Starts quiet, gets louder (black hole effect)

4. Gate/Threshold:
Formula: "if self > threshold then 1 else 0 fi"
Creates hard digital gating

5. Window function multiplication:
Formula: "self * (if sin(density*x) > 0.9 then 1 else 0 fi)"
Creates rhythmic gating pattern

📐 Convolution Visualization

Input: Short transient (drum hit)

IR: Long noise burst (5 seconds)

Convolution process:

1. Drum hit occurs at time t=0

2. IR (noise) gets triggered by drum

3. Output = drum hit "smears" into 5 seconds of noise

4. Spectral content of noise imposed on drum

Result: Drum transformed into noise burst with drum's timing

Creative use: Turn any sound into noise texture

Praat Convolution Implementation

Convolve Function Parameters

Script uses: Convolve: "sum", "zero"

🔧 Convolution Settings

Normalization: "sum"

  • Scales output so sum of IR samples = 1
  • Prevents extreme volume changes
  • Maintains approximate input loudness
  • Important for consistent results

Padding: "zero"

  • Assumes signal is zero outside boundaries
  • Simplest padding method
  • May cause artifacts at boundaries
  • Acceptable for creative applications

Alternative: "peak" normalization

  • Scales to preserve peak amplitude
  • Better for preventing clipping
  • But can make quiet IRs very loud

Computational Complexity

Why convolution can be slow:

Time domain convolution complexity: O(N·M) Where: N = input samples M = IR samples Example: 1 minute audio (44100×60 = 2.6M samples) IR: 5 seconds (44100×5 = 220,500 samples) Operations: 2.6M × 220,500 ≈ 573 billion multiplications/additions Praat optimizes using FFT convolution: O((N+M)log(N+M)) Much faster but still intensive for long IRs Memory usage: stores entire signals Can be hundreds of MB for long convolutions Practical limits: IR < 10 seconds for reasonable speed Input < 5 minutes for memory constraints Scale intensity accordingly

Spectral Transformation Principle

Frequency domain perspective: Let: X(f) = spectrum of input H(f) = spectrum of IR Y(f) = spectrum of output Convolution theorem: Y(f) = X(f)·H(f) So: |Y(f)| = |X(f)|·|H(f)| (magnitude) ∠Y(f) = ∠X(f) + ∠H(f) (phase) Interpretation: 1. Output magnitude = input magnitude × IR magnitude Frequency response of IR filters input spectrum 2. Output phase = input phase + IR phase IR phase shifts create time smearing/effects Creative implications: - Noise IR (flat spectrum) → output ≈ noise with input timing - Sine IR (single frequency) → output tuned to that frequency - Complex IR → complex filtering/imprinting

Impulse Response Modes

Mode Overview

1 Hyper-Dispersion

5s frequency sweep drone

Character: Evolving, sweeping

2 Quantum Rain

Rhythmic Gaussian noise

Character: Pitter-patter, granular

3 Fractal Zap

FM-modulated sweep

Character: Metallic, buzzing

4 Reverse Black Hole

Exponentially rising noise

Character: Sucking, inhaling

5 Alien Resonator

Harmonic chord decay

Character: Metallic, resonant

6 Cyber Glitch

Square wave chirp

Character: Digital, 8-bit

7 Bouncing Ball

Accelerating impulses

Character: Rhythmic, playful

8 Deep Space

Low-pass filtered noise

Character: Rumble, drone

9 Spectral Freeze

Long Gaussian noise

Character: Frozen, ambient

10 Demon Growl

AM-modulated noise

Character: Growling, angry

Mode Details

🌀 Hyper-Dispersion (Mode 1)

Formula: 0.5 * sin(2*3.14 * (50 + (nyquist-50)/2 * x/duration) * x)

Envelope: Linear fade-out: self * (1 - x/duration)

IR Duration: 3.0 × intensity seconds

Effect: Creates sweeping frequency drone that evolves from low to high frequencies

Intensity controls: IR duration (longer = more extreme sweep)

Best for: Drone creation, evolving textures, sci-fi effects

Sound character: Smooth, sweeping, atmospheric

🌧️ Quantum Rain (Mode 2)

Formula: randomGauss(0,0.5) (Gaussian noise)

Envelope: Rhythmic gating + exponential decay: self * (if sin(density*x) > 0.9 then 1 else 0 fi) * exp(-2*x)

IR Duration: 2.0 seconds (fixed)

Effect: Creates pitter-patter rhythmic texture from noise

Intensity controls: Gating density (15 × intensity)

Best for: Granular textures, rain effects, rhythmic noise

Sound character: Crackly, granular, organic

⚡ Fractal Zap (Mode 3)

Formula: sin(2*3.14 * (20 + 1000*x) * x) * sin(2*3.14 * modulation*x)

Envelope: Linear fade-out: self * (1 - x/duration)

IR Duration: 0.5 seconds

Effect: Frequency-modulated sweep creates metallic buzzing

Intensity controls: Modulation rate (500 × intensity Hz)

Best for: Metallic textures, insect sounds, digital artifacts

Sound character: Buzzy, metallic, synthetic

⬅️ Reverse Black Hole (Mode 4)

Formula: randomGauss(0, 0.2) (quiet Gaussian noise)

Envelope: Exponential rise: self * exp(5*(x - duration))

IR Duration: 1.0 × intensity seconds

Effect: Noise that gets exponentially louder (reverse decay)

Intensity controls: IR duration (longer = more dramatic rise)

Best for: Sucking/inhaling effects, reverse sounds, tension builds

Sound character: Whooshing, sucking, building

👽 Alien Resonator (Mode 5)

Formula: (sin(f1*x) + sin(f2*x) + sin(f3*x)) * exp(-5*x)

Envelope: Exponential decay built into formula

IR Duration: 1.0 seconds (fixed)

Effect: Three sine waves at harmonically-related frequencies create metallic chord

Intensity controls: Base frequency (500 × intensity Hz)

Best for: Metallic resonances, bell-like sounds, synthetic tones

Sound character: Ringing, metallic, harmonic

💻 Cyber Glitch (Mode 6)

Formula: round(sin(2*3.14 * (100*x + freq_rate*x^2)))

Envelope: Linear fade-out: self * (1 - x/duration)

IR Duration: 0.5 × intensity seconds

Effect: Square wave chirp (round(sin()) creates -1/0/+1 values)

Intensity controls: Chirp rate (50 × intensity)

Best for: Digital glitches, 8-bit effects, data corruption sounds

Sound character: Digital, crunchy, bit-reduced

🏀 The Bouncing Ball (Mode 7)

Formula: sin(2*3.14 * speed * x^3)

Envelope: Hard gate: if self > 0.9 then 1 else 0 fi

IR Duration: 1.0 × intensity seconds

Effect: Sine wave with accelerating frequency (x³), gated to create impulses

Intensity controls: Acceleration speed (200 × intensity)

Best for: Rhythmic effects, bouncing sounds, accelerating patterns

Sound character: Rhythmic, playful, accelerating

🪐 Deep Space (Mode 8)

Formula: randomGauss(0,1) (full-volume Gaussian noise)

Envelope: Low-pass filter (0-200Hz) + linear fade-out

IR Duration: 3.0 seconds (fixed)

Effect: Heavy low-frequency rumble from filtered noise

Intensity controls: None (fixed effect)

Best for: Sub-bass enhancement, rumble effects, space ambiance

Sound character: Deep, rumbling, atmospheric

❄️ Spectral Freeze (Mode 9)

Formula: randomGauss(0,0.1) (quiet Gaussian noise)

Envelope: Linear fade-out: self * (1 - x/duration)

IR Duration: 5.0 × intensity seconds

Effect: Very long noise impulse destroys timing, leaves only "average" spectrum

Intensity controls: IR duration (longer = more extreme freezing)

Best for: Ambient drones, spectral freezing, texture creation

Sound character: Frozen, washed, ambient

😈 Demon Growl (Mode 10)

Formula: randomGauss(0,0.5) * sin(2*3.14 * rate * x)

Envelope: None (full length)

IR Duration: 1.0 seconds (fixed)

Effect: Noise amplitude-modulated by sub-bass sine wave

Intensity controls: Modulation rate (30 × intensity Hz)

Best for: Growling effects, angry textures, AM synthesis

Sound character: Growling, aggressive, modulated

Parameters & Effects

Core Parameters

ParameterTypeDefaultDescription
Modeoptionmenu1 (Hyper-Dispersion)Transformation algorithm
Intensitypositive1.0Effect strength/duration (mode-dependent)
Scale_peakpositive0.99Output normalization to prevent clipping
Play_resultboolean1 (yes)Auto-play after processing
Keep_originalboolean1 (yes)Preserve original sound object

Intensity Interpretation by Mode

ModeWhat Intensity ControlsLow (0.1-0.5)Medium (0.5-2.0)High (2.0-5.0)
Hyper-DispersionIR durationShort sweep (0.3-1.5s)Medium sweep (1.5-6s)Long drone (6-15s)
Quantum RainGating densitySparse dropletsModerate rainHeavy downpour
Fractal ZapModulation rateSlow buzz (50-250Hz)Medium buzz (250-1000Hz)Fast sizzle (1000-2500Hz)
Reverse Black HoleIR durationQuick suck (0.1-0.5s)Medium inhale (0.5-2s)Long vacuum (2-5s)
Alien ResonatorBase frequencyLow tones (50-250Hz)Mid tones (250-1000Hz)High tones (1000-2500Hz)
Cyber GlitchIR duration & chirp rateShort glitchesMedium digital noiseLong data bursts
Bouncing BallAcceleration speedSlow bouncesMedium rhythmFast machine-gun
Deep SpaceNone (fixed)Same effectSame effectSame effect
Spectral FreezeIR durationBrief freeze (0.5-2.5s)Medium wash (2.5-10s)Extreme drone (10-25s)
Demon GrowlModulation rateSlow growl (3-15Hz)Medium pulse (15-60Hz)Fast vibration (60-150Hz)

Output Considerations

Scale_peak parameter importance:
Why needed: Convolution can create peaks much louder than input
Default 0.99: Leaves 1dB headroom, prevents clipping
If clipping occurs: Reduce to 0.8-0.9
If too quiet: Increase to 1.0 (no scaling) or use amplification after
Mode variations: Some modes create louder outputs than others
Check visually: View waveform after processing to verify no clipping
Keep_original vs memory management:
  • Keep_original = 1 (default): Original sound preserved in Objects window
  • Keep_original = 0: Original sound deleted after processing
  • Memory considerations: Each Sound object uses ~4×duration×samplerate bytes
  • For long files: Keep originals only if needed for comparison
  • For experimentation: Keep originals to try different modes
  • Praat limitation: Too many objects can slow down interface

Applications

Sound Design & Effects Creation

Use case: Generate unique sound effects from ordinary sounds

Technique: Process short, percussive sounds with extreme modes

Example: Drum hit + Spectral Freeze = evolving drone

Ambient Music Production

Use case: Create evolving pads and textures

Technique: Use Spectral Freeze, Hyper-Dispersion, Deep Space modes

Workflow:

Experimental Music

Use case: Radical transformation of acoustic sources

Technique: Chain multiple modes, extreme intensity settings

Application: Glitch, noise, avant-garde composition

Film & Game Audio

Use case: Create sci-fi, horror, fantasy sound effects

Technique:

Audio Restoration Creative Reuse

Use case: Transform degraded audio into artistic material

Technique: Process noisy/artifacted recordings with creative intent

Example: Vinyl crackle + Quantum Rain = enhanced texture

Educational Tool

Use case: Teach convolution, sound design, spectral processing

Advantages:

Practical Workflow Examples

🎬 Sci-Fi Spaceship Interior

Source: Recording of refrigerator hum or air conditioner

Processing:

  1. Mode 5: Alien Resonator (intensity 0.8) → metallic resonance
  2. Mode 8: Deep Space (intensity 1.0) → add low rumble
  3. Mode 6: Cyber Glitch (intensity 0.3) → occasional digital glitches

Result: Complex, evolving spaceship engine sound

Tip: Process each mode on copy, mix to taste

🎹 Ambient Piano Texture

Source: Clean piano chord or single note

Processing:

  1. Mode 9: Spectral Freeze (intensity 3.0) → create long drone
  2. Mode 1: Hyper-Dispersion (intensity 1.5) → add frequency sweep
  3. Mode 2: Quantum Rain (intensity 0.5) → subtle granular texture

Result: Evolving ambient pad from piano source

Tip: Freeze mode first, then add movement with other modes

🥁 Experimental Percussion

Source: Simple drum hit or percussion sample

Processing:

  1. Mode 7: Bouncing Ball (intensity 2.0) → create rhythmic pattern
  2. Mode 3: Fractal Zap (intensity 0.7) → add metallic tail
  3. Mode 4: Reverse Black Hole (intensity 0.3) → occasional suck-back

Result: Complex, evolving percussion hit

Tip: Bounce mode works best on transient-rich sources

Advanced Techniques

Serial processing (chaining modes):
  • Process 1: Apply first mode to original
  • Process 2: Apply second mode to result of first
  • Process N: Continue chaining
  • Extreme transformation: 3-4 modes can create completely new sounds
  • Order matters: Try different sequences

Example: Original → Spectral Freeze → Alien Resonator → Quantum Rain

Parallel processing (layering):
  • Create copies: Duplicate original sound
  • Different modes: Apply different mode to each copy
  • Mix together: Combine processed versions
  • Pan/balance: Place different modes in stereo field
  • Volume automation: Bring different layers in/out

Example: Layer Hyper-Dispersion (left), Quantum Rain (center), Deep Space (right)

Intensity automation:
  • Manual automation: Process multiple times with different intensities
  • Crossfade: Blend between different intensity versions
  • Dynamic effects: Create builds by increasing intensity over time
  • Rhythmic variation: Alternate between high/low intensity

Note: Praat doesn't support parameter automation within script, need manual approach

Troubleshooting Common Issues

Problem: Processing very slow
Cause: Long IR (Spectral Freeze high intensity) or long input
Solution: Reduce intensity, use shorter audio segments, be patient
Problem: Output clipping/distorted
Cause: Scale_peak too high, extreme mode settings
Solution: Reduce Scale_peak to 0.8-0.9, reduce intensity
Problem: No audible effect
Cause: IR too short, intensity too low, quiet source
Solution: Increase intensity, use louder source, try different mode
Problem: Memory error/crash
Cause: Very long convolution, too many objects
Solution: Process shorter segments, close other Praat objects, restart Praat
Problem: Output only noise/hiss
Cause: Using noise-based modes (2,4,8,9,10) with quiet source
Solution: Use tone-based modes (1,3,5,6,7) or louder source

Creative Combinations Guide

Desired EffectRecommended ModesIntensity RangeSource Material
Metallic/industrial3, 5, 60.5-2.0Percussion, impacts, mechanical sounds
Ambient/drone1, 8, 92.0-5.0Sustained sounds, pads, field recordings
Rhythmic/textural2, 7, 100.5-3.0Percussion, staccato sounds
Digital/glitch3, 4, 60.3-1.5Clean digital sounds, speech, tones
Horror/uneasy4, 5, 101.0-3.0Voice, breath, organic sounds
Sci-fi/space1, 5, 81.0-4.0Electronic sounds, drones, sweeps

Technical Notes

Mathematical Formulas Deep Dive

Understanding the Bouncing Ball Formula

Original: sin(2*3.14 * speed * x^3) Breakdown: 2*3.14 = 2π (converts Hz to angular frequency) speed = intensity × 200 (acceleration parameter) x^3 = time cubed (creates accelerating frequency) Frequency at time x: f(x) = speed × 3x² (derivative of phase) Starts at f(0) = 0 Hz Increases quadratically: f(x) ∝ x² Example: intensity=1.0, speed=200 At x=0.1s: f = 200×3×(0.1)² = 6 Hz At x=0.5s: f = 200×3×(0.5)² = 150 Hz At x=1.0s: f = 200×3×(1.0)² = 600 Hz Gate: if self > 0.9 then 1 else 0 fi Creates impulses when sine wave peaks Impulses get closer together as frequency increases Creates "bouncing ball" acceleration effect

Cyber Glitch: Round(Sin()) Trick

Key insight: round(sin(θ)) produces -1, 0, or 1 sin(θ) ranges from -1 to 1 round() converts to nearest integer: [-1, -0.5) → -1 [-0.5, 0.5) → 0 [0.5, 1] → 1 Result: three-level signal (-1, 0, +1) Creates "bit-crushed" or "8-bit" sound Frequency chirp: 100*x + rate*x² Linear term: 100*x (starting at 0 Hz, increasing) Quadratic term: rate*x² (acceleration) Creates rising chirp Combine: round(sin(chirp)) → bit-crushed chirp Digital/glitch character from quantization

Performance Optimization

Managing Convolution Speed

Factors affecting processing time:

1. Input length (N samples):
Longer = slower (linearly)
Solution: Process shorter segments

2. IR length (M samples):
Longer = much slower (convolution is O(N·M))
Spectral Freeze with high intensity → very long IR
Solution: Moderate intensity for long IRs

3. Sample rate:
Higher = more samples = slower
44.1kHz vs 96kHz: ~2× difference
Solution: Resample to lower rate if possible

4. Computer resources:
CPU speed, memory bandwidth
Praat uses single-threaded FFT convolution
Solution: Be patient, use faster computer

Estimate: Processing time ≈ (N×M) / (10⁹) seconds
Example: 1min audio + 5s IR → ~5-30 seconds

Memory Usage Considerations

Memory requirements for convolution:
Storage: Input, IR, and output all in memory
Bytes per sample: 8 (double precision)
Formula: Memory ≈ 8 × (N + M + N+M) bytes
Example: 1min @44.1kHz (2.6M samples) + 5s IR (220k samples)
Memory ≈ 8 × (2.6M + 0.22M + 2.82M) = 45 MB
Practical limit: Several hundred MB before slowdown/crash
Warning signs: Praat slows, computer fans spin up
Solution: Shorter files, moderate IR lengths

Alternative Approaches

Why Generate IRs vs Use Pre-recorded

Advantages of generated IRs:
  • Infinite variety: Parameters create infinite variations
  • Mathematical precision: Exact control over spectral properties
  • No recording needed: No microphones, rooms, or equipment
  • Extreme effects: Can create physically impossible IRs
  • Reproducible: Same parameters = same IR
  • Lightweight: Formula is compact, not audio file

Trade-off: Less "realistic" than recorded spaces, but that's the point!

Potential Script Extensions

Ideas for advanced users to modify script:
  • Stereo IRs: Generate different IRs for L/R channels
  • Parameter automation: Change intensity over time within IR
  • IR blending: Mix multiple IRs together
  • Export IRs: Save generated IRs as Sound files for reuse
  • Graphical preview: Show IR waveform before convolution
  • More modes: Add user-defined formula entry
  • Batch processing: Apply same mode to multiple files

Script is designed to be extensible — formulas are clearly separated