Karplus-Strong Modulator — User Guide

Physical modeling synthesis meets audio processing: applies the classic Karplus-Strong string synthesis algorithm as a real-time modulation effect, creating plucked string textures, metallic resonances, and sci-fi soundscapes from any audio input.

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 Karplus-Strong modulation — an innovative audio processing technique that adapts the classic Karplus-Strong physical modeling synthesis algorithm for real-time audio effects processing. Unlike traditional Karplus-Strong which generates sound from noise bursts, this modulator processes existing audio through a tuned delay line with feedback, creating plucked string resonances, metallic textures, and evolving sci-fi effects that respond dynamically to the input signal.

Key Features:

What is Karplus-Strong synthesis? Developed in 1983 by Kevin Karplus and Alex Strong, this revolutionary algorithm simulates plucked string instruments using a simple digital delay line with feedback. Traditional implementation: Generate noise burst → process through tuned delay line with averaging filter → creates realistic string sounds. This modulator adaptation: Process existing audio → apply Karplus-Strong resonator as effect → creates hybrid textures combining source characteristics with string-like resonances. Core components: (1) Tuned delay line: Sets fundamental frequency, (2) Averaging filter: Creates string-like decay, (3) Feedback loop: Controls sustain length, (4) Pitch modulation: Adds movement and animation. Advantages: (1) Physical accuracy: Based on real acoustic principles, (2) Computational efficiency: Simple algorithm, complex results, (3) Musical character: Naturally pleasing resonances, (4) Creative potential: Endless sound design possibilities.

Technical Implementation: (1) Signal Flow: Input audio → mixed with feedback signal → processed through tuned delay line → applied averaging filter → fed back into input. (2) Delay Line Tuning: Delay time = 1/frequency, creating resonant frequency. (3) Pitch Modulation: LFO controls delay time variation: modulated_delay = 1/(base_freq × 2^(depth×sin(2π×rate×t)/12)). (4) Averaging Filter: (self[t-delay] + self[t-delay-dt])/2 creates low-pass filtering. (5) Feedback Control: Decay parameter (0.5-0.99) controls feedback amount. (6) Mixing: Dry/wet blend preserves original signal characteristics. Key insight: The algorithm transforms any audio into resonant, string-like textures while preserving the original's rhythmic and spectral character.

Quick start

  1. In Praat, select exactly one Sound object.
  2. Run script…karplus_strong_modulator.praat.
  3. Choose Preset or select "Custom" for manual control:
    • Deep Bass Pluck — Low-frequency string effects
    • Sci-Fi Siren — Sweeping modulated textures
    • Metallic Chime — Bright, sustained resonances
    • Warp Drive Engine — Intense, complex modulation
  4. For custom settings, adjust parameters:
    • Ks_Base_Freq — Resonator frequency (Hz)
    • Ks_Mod_Rate — Pitch modulation speed
    • Ks_Mod_Depth — Pitch modulation intensity
    • Ks_Decay — Resonance sustain length
    • Ks_Mix — Dry/wet balance
  5. Enable Play_result for immediate preview.
  6. Click OK — processing applied, result named "originalname_KS_Mod".
Quick tip: Start with presets to understand the effect character — each preset demonstrates a different aspect of Karplus-Strong processing. Use percussive or transient-rich sources for the most dramatic effects — drum hits, vocal consonants, plucked instruments. For subtle texturing, use lower mix amounts (0.2-0.4). For transformative effects, use higher mix amounts (0.6-0.8). The effect works particularly well on monophonic material — complex polyphonic sources may create dense, unpredictable results. Processing is relatively fast — most sounds process in under 10 seconds.
Important: FEEDBACK SENSITIVE — high decay values (>0.98) with certain frequency settings can create runaway feedback or extreme resonance buildup. Extreme modulation depths (>24 semitones) can cause aliasing or mathematical instability. The algorithm is computationally intensive — very long audio files may take significant processing time. Low base frequencies (< 50 Hz) require long delay lines and may cause memory issues. Very dry sources (no reverb, no sustain) work best — heavily processed sources may create chaotic results. Always preview with play_result enabled before applying to important material.

Quick Presets

Preset 1: Custom

🎛️ Full Parameter Control

Character: Complete manual control over all Karplus-Strong parameters

Use case: Experimental sound design, specific musical requirements

Recommended for: Advanced users familiar with physical modeling synthesis

Preset 2: Deep Bass Pluck

🎸 Subharmonic String Resonance

Settings: freq=80Hz, rate=0.2Hz, depth=1.0, decay=0.85, mix=0.6

Character: Deep, punchy bass string simulations

Sonic qualities: Strong fundamental, quick decay, subtle pitch variation

Best for: Bass enhancement, kick drum processing, low-end reinforcement

Source recommendations: Kick drums, basslines, low vocal tones

Preset 3: Sci-Fi Siren

🚀 Sweeping Synthetic Textures

Settings: freq=440Hz, rate=0.3Hz, depth=12, decay=0.96, mix=0.5

Character: Slow, evolving pitch sweeps with long sustain

Sonic qualities: Prominent pitch modulation, atmospheric decay, cinematic feel

Best for: Sound design, sci-fi effects, atmospheric pads

Source recommendations: Synthetic sounds, vocal sustains, noise bursts

Preset 4: Metallic Chime

🔔 Bright Sustained Resonances

Settings: freq=880Hz, rate=6.0Hz, depth=0.5, decay=0.99, mix=0.4

Character: Bright, metallic tones with fast subtle modulation

Sonic qualities: High frequency focus, very long decay, shimmering texture

Best for: Bell-like effects, harmonic enhancement, ethereal textures

Source recommendations: Cymbals, glass sounds, high-frequency content

Preset 5: Warp Drive Engine

⚡ Intense Complex Modulation

Settings: freq=150Hz, rate=8.0Hz, depth=24, decay=0.92, mix=0.8

Character: Aggressive, complex pitch distortion effects

Sonic qualities: Extreme modulation, medium decay, transformative results

Best for: Experimental music, sound destruction, intense effects

Source recommendations: Drum loops, complex textures, noise sources

Preset Sonic Characteristics

PresetFrequency FocusModulation StyleDecay CharacterMusical Use
Deep Bass PluckSub-bass (80Hz)Very slow, subtleShort, punchyRhythmic reinforcement
Sci-Fi SirenMid-range (440Hz)Slow, sweepingLong, evolvingAtmospheric pads
Metallic ChimeHigh (880Hz)Fast, subtleVery longTextural enhancement
Warp Drive EngineLow-mid (150Hz)Very fast, extremeMediumSound destruction

Karplus-Strong Theory

Original Algorithm Foundation

🎻 Physical String Modeling

Historical context: Developed 1983 by Karplus & Strong at Stanford

Core insight: Digital delay line + averaging filter = string simulation

Revolutionary impact: First realistic physical modeling synthesis

This adaptation: Applies same principles as audio effect rather than sound generator

Classic Karplus-Strong Synthesis

Traditional implementation for sound generation:

// 1. EXCITATION: Create noise burst noise_burst = white_noise(duration) // 2. RESONATOR: Tuned delay line with feedback FOR each sample: output = noise_burst[current] + feedback * delay_line[read_position] // 3. FILTERING: Averaging low-pass filtered = (delay_line[read_position] + delay_line[read_position+1]) / 2 // 4. FEEDBACK: Sustain control delay_line[write_position] = filtered update read/write positions // Result: Realistic plucked string sound from noise

Modulator Adaptation

From Synthesis to Effect Processing

Key modifications for audio processing:

// ORIGINAL: Generate sound from noise input = white_noise() // MODULATOR: Process existing audio input = original_sound[] // ADDITION: Pitch modulation delay_time = 1 / (base_freq * modulation_factor) // ADDITION: Dry/Wet mixing output = processed * mix + original * (1 - mix) // PRESERVED: Core resonator algorithm feedback_signal = decay * (delay_line[t-delay] + delay_line[t-delay-dt]) / 2

Mathematical Foundation

Delay Line Resonance

Fundamental frequency calculation:

Basic resonance condition: f₀ = 1 / τ Where: f₀ = fundamental frequency (Hz) τ = delay time (seconds) With sample rate consideration: τ = N / sr Where: N = delay in samples sr = sampling rate (Hz) Therefore: f₀ = sr / N This creates a comb filter with peaks at: f_k = k × f₀ (k = 1, 2, 3, ...)

Averaging Filter Analysis

Low-pass filtering effect:

Averaging filter transfer function: H(z) = (1 + z⁻¹) / 2 Frequency response: |H(ω)| = |cos(ω/2)| Where: ω = 2πf / sr This creates: - Low-pass characteristic - First zero at Nyquist frequency - -6 dB/octave rolloff - Natural string brightness decay Combined with delay line: Creates harmonic series with high-frequency damping Mimics real string behavior

Complete Algorithm Mathematics

Final Processing Formula

The complete Karplus-Strong modulator equation:

Output[t] = Input[t] + Decay × (Output[t-τ] + Output[t-τ-Δt]) / 2 With pitch modulation: τ[t] = 1 / (f₀ × 2^(d×sin(2π×r×t)/12)) Where: Input[t] = original sound at time t Output[t] = processed sound at time t Decay = feedback coefficient (0.5-0.99) τ[t] = modulated delay time f₀ = base frequency (Hz) d = modulation depth (semitones) r = modulation rate (Hz) Δt = sampling period (1/sr) Dry/Wet mixing: Final[t] = Output[t] × mix + Input[t] × (1 - mix)

Physical Interpretation

Why It Sounds Like Strings

Acoustic correspondence:

Delay Line: Represents string length
Longer delay = lower pitch = longer string
Shorter delay = higher pitch = shorter string

Averaging Filter: Represents string stiffness
Causes high-frequency damping
Creates natural brightness decay
Mimics real string physics

Feedback: Represents energy conservation
Higher decay = less energy loss = longer sustain
Lower decay = more damping = shorter decay

Excitation: Original audio as "pluck"
Transients excite the resonator
Sustained sections create continuous excitation

Technical Implementation

Praat Formula Construction

Step-by-step formula assembly:

// 1. CONSTANTS pi = 3.14159265359 2pi = 2 * pi dt = 1 / sampling_rate // 2. MODULATION COMPONENT sine_wave = sin(2pi * mod_rate * x) pitch_shift = 2^(mod_depth * sine_wave / 12) modulated_freq = base_freq * pitch_shift // 3. DELAY CALCULATION delay_time = 1 / modulated_freq // 4. KARPLUS-STRONG CORE feedback = decay * (self[x - delay_time] + self[x - delay_time - dt]) / 2 output = Sound_RefSource[] + feedback // 5. DRY/WET MIX final = output * mix + Sound_RefSource[] * (1 - mix)

Parameters & Controls

Core Resonance Parameters

ParameterTypeRangeDefaultDescription
Ks_Base_Freqpositive20-2000 Hz220 HzFundamental resonance frequency
Ks_Decayreal0.5-0.990.95Resonance sustain length
Ks_Mixreal0.0-1.00.5Dry/wet balance

Pitch Modulation Parameters

ParameterTypeRangeDefaultDescription
Ks_Mod_Ratepositive0.1-20.0 Hz0.5 HzPitch modulation speed
Ks_Mod_Depthreal0.0-24.012.0Pitch modulation intensity in semitones

Output Parameters

ParameterTypeRangeDefaultDescription
Play_resultboolean0/11Auto-play after processing

Parameter Effects Guide

Ks_Base_Freq (20-2000 Hz):
20-100 Hz: Sub-bass resonance, string bass
100-300 Hz: Bass/mid resonance, guitar range
300-800 Hz: Mid-range, vocal formant area
800-2000 Hz: High resonance, metallic textures
>2000 Hz: Very high, potentially aliasing

Ks_Decay (0.5-0.99):
0.50-0.70: Very short, percussive plucks
0.70-0.85: Medium decay, typical strings
0.85-0.95: Long sustain, bowed effects
0.95-0.99: Very long, near-infinite sustain
>0.99: Risk of feedback instability

Ks_Mod_Rate (0.1-20.0 Hz):
0.1-1.0 Hz: Slow, obvious sweeps
1.0-5.0 Hz: Medium, vibrato-like
5.0-10.0 Hz: Fast, intense modulation
10.0-20.0 Hz: Very fast, potentially chaotic

Ks_Mod_Depth (0.0-24.0 semitones):
0.0-1.0: Subtle pitch variation
1.0-6.0: Moderate detuning effects
6.0-12.0: Strong pitch bends
12.0-24.0: Extreme, octave+ modulation

Parameter Interactions

How Parameters Affect Each Other

Key relationships and combinations:

Base_Freq × Decay:
Low freq + high decay = deep, rumbling bass
High freq + high decay = shimmering, metallic sustains
Low freq + low decay = punchy, short bass plucks
High freq + low decay = bright, percussive chimes

Mod_Rate × Mod_Depth:
Slow rate + high depth = dramatic pitch sweeps
Fast rate + low depth = subtle vibrato
Fast rate + high depth = intense pitch distortion
Slow rate + low depth = barely noticeable variation

Mix × All Parameters:
Low mix (0.1-0.3): Subtle enhancement
Medium mix (0.4-0.6): Balanced effect
High mix (0.7-0.9): Dominant processing
Very high mix (1.0): Complete transformation

Applications

String Instrument Emulation

Use case: Adding string-like characteristics to non-string sources

Technique: Use mid-range frequencies (100-400 Hz) with medium decay

Examples: Vocal to cello, drum hits to pizzicato, synth to string ensemble

Sound Design and Effects

Use case: Creating unique synthetic textures and sci-fi effects

Technique: Extreme modulation settings with high mix amounts

Results: Warp drives, alien communications, futuristic interfaces

Percussive Enhancement

Use case: Adding resonance and sustain to percussive sounds

Technique: Tune to fundamental frequency of drum sounds

Applications: Tom resonance, kick drum body, snare ring control

Experimental Music

Use case: Creating complex, evolving textures from simple sources

Technique: Process already-processed material multiple times

Results: Granular-like textures, spectral smearing, time-stretched effects

Practical Workflow Examples

🎻 Vocal to String Transformation

Goal: Transform vocal phrases into cello-like textures

Settings:

  • Base_Freq: 220 Hz (cello A string)
  • Decay: 0.88 (medium sustain)
  • Mod_Rate: 0.5 Hz (subtle vibrato)
  • Mod_Depth: 0.3 (very subtle)
  • Mix: 0.7 (strong effect)

Result: Vocal phrases with rich string-like resonance and sustain

🥁 Drum Resonance Enhancement

Goal: Add body and resonance to drum samples

Settings:

  • Base_Freq: Match drum fundamental (60-120 Hz for kicks)
  • Decay: 0.82 (quick but noticeable)
  • Mod_Rate: 0.1 Hz (barely moving)
  • Mod_Depth: 0.1 (minimal)
  • Mix: 0.3-0.4 (subtle enhancement)

Result: Drums with enhanced low-end body and natural sustain

🚀 Sci-Fi Engine Design

Goal: Create evolving spaceship engine sounds

Settings:

  • Base_Freq: 180 Hz (engine rumble)
  • Decay: 0.96 (long, evolving)
  • Mod_Rate: 0.8 Hz (slow sweep)
  • Mod_Depth: 8.0 (noticeable pitch variation)
  • Mix: 0.9 (dominant effect)

Result: Complex, evolving engine textures with pitch sweeps

Advanced Techniques

Creative processing chains:
  • Multiple passes: Apply different frequency settings sequentially
  • Frequency sweeping: Automate base frequency over time
  • Extreme settings: Push parameters beyond normal ranges for experimental results
  • Source manipulation: Pre-process audio before Karplus-Strong application

Layer multiple processed versions for complex, evolving textures

Musical considerations:
  • Tuning: Set base frequency to musical notes for harmonic results
  • Rhythm: Use rhythmic sources to create patterned resonances
  • Texture: Process noise sources for complex, evolving beds
  • Space: Combine with reverb for atmospheric, spatial effects

Troubleshooting Common Issues

Problem: Runaway feedback/extreme resonance
Cause: High decay values with certain frequency combinations
Solution: Reduce decay to 0.85-0.95 range, adjust base frequency
Problem: Aliasing/ digital artifacts
Cause: Extreme modulation depths or very high base frequencies
Solution: Reduce modulation depth, lower base frequency below 1000 Hz
Problem: Effect too subtle
Cause: Low mix amount or inappropriate source material
Solution: Increase mix to 0.6-0.8, use more transient-rich sources
Problem: Processing very slow
Cause: Very low base frequencies creating long delay lines
Solution: Use higher base frequencies (>80 Hz) for faster processing

Technical Reference

Algorithm Performance Characteristics

AspectCharacteristicImpact
Computational ComplexityO(N) per sampleLinear with duration
Memory UsageO(sr/min_freq)Depends on lowest frequency
Processing SpeedMediumFaster than convolution, slower than filters
Real-time capabilityYes (with optimization)Suitable for real-time implementation
Quality FactorsSample-rate dependentHigher SR = better high-frequency response

Physical Modeling Accuracy

Real String Physics vs Karplus-Strong:

ACCURATE:
- Harmonic series generation
- Brightness decay over time
- Pitch determination by length
- Plucked string transient character

SIMPLIFIED:
- Ideal string (no stiffness variation)
- Perfect termination (no body resonance)
- Linear decay (no complex damping)
- Single excitation model

ENHANCED IN THIS VERSION:
- Dynamic pitch control (not in original)
- Audio input processing (original used noise)
- Dry/wet mixing flexibility

Historical Context and Impact

📜 Algorithm Evolution

1983: Original Karplus-Strong paper published — revolutionizes physical modeling

1980s-90s: Widespread adoption in computer music and commercial synthesizers

2000s: Extended and refined versions developed (extended Karplus-Strong)

This work: First adaptation as real-time audio effect processor in Praat

Significance: Demonstrates classic synthesis algorithms can become powerful effects