Harmonic Comb Filter — User Guide

Spectral resonance: applies harmonic series-based comb filtering to create complex resonant patterns and metallic textures through mathematical delay structures.

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 harmonic comb filtering — an advanced audio processing technique that creates complex resonant patterns using mathematical harmonic series. Generates multiple delay lines tuned to harmonic ratios of a fundamental frequency, creating intricate comb filtering effects that emphasize specific harmonic relationships. Process applies weighted, modulated delays at harmonic intervals to produce rich metallic textures and resonant characteristics.

Key Features:

What is harmonic comb filtering? Traditional comb filtering: single delay creates periodic notches. Harmonic comb: multiple delays at harmonic intervals create complex resonant patterns. Advantages: (1) Musical structure: Harmonic series creates musically coherent filtering. (2) Complex textures: Multiple delays interact to create rich patterns. (3) Natural weighting: Inverse square law mimics acoustic behavior. (4) Dynamic character: Phase modulation creates evolving effects. (5) Controlled randomness: Random fundamentals within defined ranges. Use cases: Metallic sound design, resonant effects, harmonic enhancement, experimental processing, acoustic simulation.

Quick start

  1. Select Sound object in Praat
  2. Run harmonic_comb_filter.praat
  3. Choose preset for pre-configured comb characters
  4. Or adjust number_of_harmonics for spectral complexity
  5. Set fundamental_delay_min/max for base frequency range
  6. Configure modulation_divisor for time variation speed
  7. Click OK — harmonic comb filtering applied
Quick tip: Start with Medium Comb for balanced resonant effects. Use Subtle Comb for gentle enhancement or Extreme Comb for dramatic metallic transformations. Each processing creates unique results due to random fundamental selection.
Random Results: Due to the random fundamental delay selection and phase shifts, each processing creates different results even with identical parameters. The presets provide characteristic behaviors rather than exact patterns.

Harmonic Theory

Harmonic Series Algorithm

🎵 Mathematical Harmonic Structure

Core harmonic delay calculation:

1. Generate random fundamental: fundamental_delay = randomUniform(fundamental_delay_min, fundamental_delay_max) 2. For each harmonic (1 to number_of_harmonics): Calculate harmonic delay: harmonic_delay = fundamental_delay / harmonic Calculate harmonic weight: harmonic_weight = 1.0 / (harmonic × harmonic) Generate phase shift: phase_shift = randomUniform(0, 2×π) 3. Apply comb filtering formula: Formula: "self + harmonic_weight × (self[col+harmonic_delay] - self[col]) × cos(phase_shift + 2×π×col×harmonic/modulation_divisor)" Key properties: Harmonic series: 1, 1/2, 1/3, 1/4, etc. Inverse square weighting: 1, 1/4, 1/9, 1/16, etc. Phase modulation creates time variation Each harmonic contributes to complex pattern

Comb Filter Mathematics

🔍 Spectral Notch Creation

Frequency response analysis:

Single comb filter frequency response: Notches occur at: f = (n + 1/2) / delay_time Peaks occur at: f = n / delay_time For harmonic comb with multiple delays: Multiple notch/peak patterns overlap Creates complex resonant structure Harmonic relationship ensures musical coherence Comb filter formula analysis: output = input + weight × (delayed - input) = (1 - weight) × input + weight × delayed Frequency response characteristics: Periodic peaks and notches in spectrum Spacing determined by delay time Multiple delays create overlapping patterns Weighting controls resonance intensity Modulation effects: cos(phase_shift + 2π×col×harmonic/modulation_divisor) Creates time-varying comb characteristics Prevents static, artificial sound

Parameter Interactions

ParameterFunctionEffect
number_of_harmonicsSpectral complexityMore harmonics = denser, richer resonant patterns
fundamental_delay_min/maxBase frequency rangeControls fundamental comb spacing and character
modulation_divisorTime variation speedSmaller = faster modulation, more dynamic effect
harmonic_weightAmplitude weightingInverse square law (1/n²) for natural decay
phase_shiftInitial phaseRandom per harmonic for complex interactions

Mathematical Foundation

Harmonic series properties: Fundamental: delay = fundamental_delay 2nd harmonic: delay = fundamental_delay / 2 3rd harmonic: delay = fundamental_delay / 3 ... nth harmonic: delay = fundamental_delay / n Inverse square weighting: Weight for harmonic n = 1 / n² Fundamental: weight = 1 2nd harmonic: weight = 1/4 = 0.25 3rd harmonic: weight = 1/9 ≈ 0.111 4th harmonic: weight = 1/16 = 0.0625 Natural amplitude decay mimics acoustic behavior Frequency relationships: Comb notch spacing = 1 / delay_time Harmonic delays create related notch patterns Fundamental sets overall spectral character Higher harmonics add detail and complexity Modulation mathematics: Modulation frequency = harmonic / modulation_divisor Higher harmonics modulate faster Creates evolving spectral patterns Prevents static comb filtering artifacts

Comb Presets

PresetHarmonicsDelay MinDelay MaxModulationCharacter
Subtle Comb430801200Gentle resonance, subtle enhancement
Medium Comb7201001000Balanced resonant effects
Heavy Comb1115120850Pronounced metallic character
Extreme Comb1610150700Intense, complex resonant patterns

🎛️ Resonant Character Applications

Subtle Comb: Add gentle resonance and presence to vocals and instruments. Creates subtle enhancement without obvious filtering artifacts.

Medium Comb: Produce classic resonant effects for musical applications. Balanced between effect character and signal preservation.

Heavy Comb: Create pronounced metallic and resonant textures for sound design. Clear comb filtering character that transforms audio.

Extreme Comb: Generate intense, complex resonant patterns for experimental music and extreme sound design. Maximum spectral complexity.

Spectral Characteristics

Frequency response patterns: Fundamental delay range (10-150 samples): Corresponding frequency range (at 44.1kHz): Min: 44100/150 = 294 Hz Max: 44100/10 = 4410 Hz Creates comb filtering in mid-high frequency range Harmonic distribution: Each harmonic adds spectral detail Higher harmonics create finer comb spacing Inverse square weighting prevents high-frequency buildup Modulation effects: Modulation divisor range (700-1200): Corresponding modulation rates: Fast: harmonic/700 (higher rate) Slow: harmonic/1200 (lower rate) Creates time-varying spectral patterns Prevents static, artificial sound Typical results: Metallic, resonant character Complex spectral peaks and notches Evolving, dynamic filtering Musically coherent harmonic structure

Applications

Sound Design

Metallic Textures: Use Heavy or Extreme Comb to transform organic sounds into metallic, resonant textures. Ideal for creating synthetic metallic sounds from natural sources.
Resonant Effects: Apply harmonic comb filtering to create complex resonant chambers and acoustic environments. The harmonic structure creates believable resonant spaces.

Music Production

Vocal Enhancement: Use Subtle Comb to add presence and character to vocal tracks. The harmonic structure enhances vocal harmonics in musically coherent ways.
Instrument Processing: Apply comb filtering to synthesizers, guitars, or percussion to create unique tonal variations and add resonant character.

Experimental Audio

Spectral Studies: Use the script to explore how harmonic comb filtering affects different sound types. The controlled parameters allow systematic investigation of resonant effects.
Algorithmic Effects: Combine harmonic comb filtering with other processing techniques to create complex, multi-layered spectral effects for experimental music.

Technical Considerations

Delay Range Limits: Very short fundamental delays (near 10 samples) can create very high-frequency comb patterns that may cause aliasing or extreme high-frequency content.
Modulation Intensity: Very small modulation divisors (below 500) can create rapid modulation that may cause unwanted artifacts or excessive time variation.
Musical Coherence: The harmonic series foundation ensures that the comb filtering effects remain musically coherent, with harmonic relationships that work well with most musical content.