XMod — Cross Modulation Plugin User Guide

Advanced audio modulation: ring modulation, amplitude modulation, and rhythmic gating for creative sound design and effects processing.

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

What this does

This script implements cross modulation — a collection of audio modulation techniques for creative sound processing. Three primary modulation types: (1) Ring Modulation: Multiplies carrier signal with modulator, creating sum/difference frequencies (metallic, bell-like tones). (2) Amplitude Modulation (AM): Classic tremolo/radio-style modulation where modulator controls carrier amplitude. (3) Rhythmic Gate: Rhythmic amplitude gating with adjustable attack/release and duty cycle for stutter, pulse, and sidechain effects. Multiple modulator sources: internal oscillators (sine, square, triangle, sawtooth) or external audio files. Real-time modulator visualization, 9 built-in presets, and comprehensive parameter control.

Key Features:

What is cross modulation? Traditional modulation: LFOs, envelope followers, sidechain compression. Cross modulation: Mathematical multiplication of audio signals for frequency shifting, amplitude variation, and rhythmic effects. Ring modulation: Creates inharmonic spectra (sum/difference frequencies) — classic sci-fi/robot voices. Amplitude modulation: Creates tremolo/vibrato effects — vintage radio, underwater sounds. Rhythmic gating: Creates rhythmic amplitude patterns — stutter, pulse, sidechain pumping. Advantages: (1) Creative sound design: Transform ordinary sounds into unusual textures. (2) Musical effects: Add movement and rhythm to static sounds. (3) Frequency manipulation: Create new harmonic/inharmonic content. (4) Flexible control: Wide parameter range for fine-tuning. Use cases: Sound design (sci-fi effects), music production (rhythmic interest), experimental composition (textural transformation), audio restoration (creative masking).

Technical Implementation: (1) Carrier selection: Primary audio to be modulated. (2) Modulator generation: Create modulator signal via oscillator or load external audio. (3) Signal multiplication: Apply modulation formula based on type. (4) Envelope shaping: For rhythmic gate, apply attack/release smoothing. (5) Output normalization: Scale output to prevent clipping. Processing methods: Sample-by-sample multiplication with optional chunking for long files. Modulator visualization uses Praat's drawing capabilities. External modulator audio automatically trimmed/padded to match carrier duration.

Quick start

  1. In Praat, select one Sound object (or two for external modulator).
  2. Run script…XMod_Cross_Modulation.praat.
  3. Choose Preset or select "Custom" for manual control.
  4. Select Mod_type: Ring Modulation, Amplitude Modulation, or Rhythmic Gate.
  5. Choose Mod_source: Oscillator type or "Second Sound".
  6. Set Mod_frequency (Hz) and Mod_depth (0-1 for AM/Gate, any for Ring).
  7. For Rhythmic Gate: adjust Attack, Release (ms), and Duty_cycle.
  8. Enable Draw_modulator to visualize modulator waveform.
  9. Click OK — modulation applied, result named "originalname_xmod".
Quick tip: Start with presets for immediate results — "Ring Mod - Metallic" for sci-fi effects, "AM - Tremolo" for vintage vibrato, "Gate - Helicopter" for rhythmic chopping. Use external audio modulators for complex, evolving modulation patterns. Enable Draw_modulator to preview modulation waveform. Adjust depth carefully: 0 = no effect, 1 = full effect. For rhythmic effects, match frequency to musical tempo (e.g., 2 Hz = 120 BPM). External modulators: select carrier first, modulator second. Processing time depends on file length (instant for short files).
Important: AMPLITUDE MULTIPLICATION — modulation multiplies carrier amplitude, can cause clipping if depth > 1. Ring modulation creates inharmonic content — may sound metallic or dissonant. Low frequencies (< 20 Hz) create rhythmic effects, high frequencies (> 100 Hz) create timbral changes. External modulators require exactly 2 selected sounds. Gate attack/release too short may cause clicks; too long may blur rhythm. Duty cycle controls ON/OFF ratio (0.5 = equal on/off). Depth = 1.0 for ring mod creates full effect; for AM creates 100% modulation. Visual preview recommended for unfamiliar parameters.

Modulation Theory

Ring Modulation

📡 Frequency Shifting

Formula: Output = Carrier × Modulator

Mathematical basis: sin(ω₁t) × sin(ω₂t) = ½[cos((ω₁-ω₂)t) - cos((ω₁+ω₂)t)]

Effect: Creates sum and difference frequencies, eliminates original frequencies

Character: Metallic, bell-like, inharmonic, robotic

Frequency relationships: Carrier frequency: f_c Modulator frequency: f_m Output frequencies: f_c ± f_m Example: f_c = 440 Hz (A4), f_m = 100 Hz Output contains: 340 Hz and 540 Hz Original 440 Hz removed For complex signals: Each frequency component in carrier interacts with modulator Creates dense, metallic spectra Practical use: f_m < 30 Hz: Slow amplitude variation (subtle) f_m = 30-100 Hz: Rhythmic/timbral effects f_m > 100 Hz: Strong harmonic transformation

Amplitude Modulation (AM)

📻 Classic Tremolo

Formula: Output = Carrier × (1 + Depth × Modulator) / 2

Mathematical basis: A[1 + m·cos(ωₘt)]·cos(ωₖt) where m = modulation index

Effect: Varies amplitude at modulator frequency

Character: Vibrato/tremolo, radio effect, underwater

AM spectrum: Carrier frequency: f_c Modulator frequency: f_m Output frequencies: f_c, f_c ± f_m Example: f_c = 440 Hz, f_m = 10 Hz, depth = 0.8 Output contains: 440 Hz (carrier), 430 Hz, 450 Hz (sidebands) Original frequency preserved Depth control: Depth = 0: No modulation (original signal) Depth = 1: Full modulation (100% amplitude variation) 0 < Depth < 1: Proportional modulation Modulator shape: Sine: Smooth tremolo Square: Hard tremolo (on/off) Triangle/Saw: Linear amplitude transitions

Rhythmic Gate

⏱️ Rhythmic Amplitude Control

Formula: Output = Carrier × Gate_Envelope

Process: Convert modulator to gate envelope with attack/release smoothing

Effect: Rhythmic amplitude gating (stutter, pulse, sidechain)

Character: Chopped, pulsed, rhythmic, pumping

Gate parameters: Frequency: Gate cycle rate (Hz = cycles/second) Duty cycle: ON time proportion (0-1) Attack: ON transition time (milliseconds) Release: OFF transition time (milliseconds) Example: Frequency = 4 Hz, Duty = 0.3, Attack = 5 ms, Release = 50 ms 4 Hz = 4 cycles/second = 250 ms period ON time = 250 ms × 0.3 = 75 ms OFF time = 250 ms × 0.7 = 175 ms Attack: 5 ms fade in at each gate opening Release: 50 ms fade out at each gate closing Envelope creation: 1. Generate square/pulse wave at frequency 2. Convert bipolar (-1 to 1) to unipolar (0 to 1) 3. Apply low-pass filtering based on attack/release 4. Normalize to 0-1 range 5. Apply depth scaling

Modulator Sources

Oscillator types: SINE: Formula: sin(2πft) Shape: Smooth, rounded Use: Smooth modulation, natural tremolo SQUARE: Formula: if (phase mod 1) < duty_cycle then 1 else -1 Shape: Rectangular, abrupt transitions Use: Hard gating, stutter effects TRIANGLE: Formula: if phase < 0.5 then 4×phase-1 else 3-4×phase Shape: Linear ramps Use: Smooth amplitude sweeps SAWTOOTH: Formula: 2×(phase mod 1)-1 Shape: Linear rise, instant drop Use: Sweeping effects, classic synth EXTERNAL AUDIO: Use: Any sound file as modulator Process: Match duration to carrier, convert to mono, normalize Effect: Complex, evolving modulation patterns

Complete Processing Pipeline

SETUP: Select carrier sound (and modulator if external) Choose preset or custom parameters Set modulation type, source, frequency, depth For gate: set attack, release, duty cycle MODULATOR GENERATION: IF oscillator source: Create formula-based sound at specified frequency Apply waveform shape (sine/square/triangle/saw) IF external audio: Load second sound, match duration to carrier Convert to mono, normalize VISUALIZATION (optional): Draw modulator waveform (3 cycles or 0.3s minimum) Display frequency, depth, gate parameters MODULATION APPLICATION: Copy carrier → "output" IF ring modulation: Formula: output = carrier × (modulator × depth + (1-depth)) Full multiplication with depth control IF amplitude modulation: Formula: output = carrier × (1 + depth × modulator) / 2 Preserves carrier, adds sidebands IF rhythmic gate: Create gate envelope from modulator Apply attack/release smoothing (low-pass filtering) Formula: output = carrier × gate_envelope × depth + carrier × (1-depth) Rhythmic amplitude control FINALIZATION: Rename to "originalname_xmod" Normalize peak to 0.95 (prevent clipping) Optional: Play result Display summary (type, source, frequency, depth) OUTPUT: Modulated sound with cross-modulation effects

Modulation Types

Type 1: Ring Modulation

🔔 Frequency Multiplication

Formula: Output = Carrier × Modulator

Effect: Creates sum/difference frequencies, metallic tones

Depth interpretation: Any value, 1.0 = full multiplication

Best for: Sci-fi effects, metallic textures, bell-like tones

Parameter ranges:

Type 2: Amplitude Modulation (AM)

📻 Classic Tremolo

Formula: Output = Carrier × (1 + Depth × Modulator) / 2

Effect: Amplitude variation at modulator frequency

Depth interpretation: 0-1, proportion of amplitude variation

Best for: Tremolo, vibrato, radio effects, underwater sounds

Parameter ranges:

Type 3: Rhythmic Gate

⏱️ Rhythmic Chopping

Formula: Output = Carrier × Gate_Envelope

Effect: Rhythmic amplitude gating with smoothing

Additional parameters: Attack, release, duty cycle

Best for: Stutter effects, sidechain pumping, rhythmic patterns

Parameter ranges:

Built-in Presets

Ring Modulation Presets

PresetParametersCharacterUse Case
Ring Mod - MetallicSine, 440 Hz, depth 1.0Classic metallic ring modSci-fi effects, robot voices
Ring Mod - DeepSine, 80 Hz, depth 1.0Low frequency ring modSubharmonic generation, drones

Amplitude Modulation Presets

PresetParametersCharacterUse Case
AM - Radio StyleSine, 1000 Hz, depth 0.8High frequency tremoloVintage radio effect
AM - TremoloSine, 6 Hz, depth 0.7Musical tremoloGuitar amp tremolo, vibrato

Rhythmic Gate Presets

PresetParametersCharacterUse Case
Gate - Fast StutterSquare, 10 Hz, duty 0.5, A/R 2 msFast rhythmic choppingGlitch effects, stutter edits
Gate - Slow PulseSquare, 2 Hz, duty 0.5, A/R 10 msSlow rhythmic pulseAmbient pulsing, background rhythm
Gate - HelicopterSquare, 12.5 Hz, duty 0.5, A/R 1 msMedium-fast choppingHelicopter effect, mechanical rhythm
Sidechain StyleSquare, 2 Hz, duty 0.3, A/R 5/80 msSidechain pumpingEDM-style sidechain compression

Parameter Reference

ParameterTypeDefaultDescription
PresetoptionCustom9 built-in presets or custom
Mod_typeoptionRing ModulationRing, AM, or Rhythmic Gate
Mod_sourceoptionSine Oscillator4 oscillators or external audio
Mod_frequencypositive10Modulator frequency in Hz
Mod_depthreal1.0Modulation depth (0-1 for AM/Gate)
Attackpositive5Gate attack time in milliseconds
Releasepositive5Gate release time in milliseconds
Duty_cyclepositive0.5Gate ON time proportion (0-1)
Draw_modulatorboolean1Visual preview of modulator
Play_resultboolean1Auto-play after processing

Applications

Sound Design & Effects

Use case: Transform ordinary sounds into special effects

Techniques:

Music Production

Use case: Add movement and interest to tracks

Techniques:

Experimental Composition

Use case: Create evolving textures and complex modulations

Techniques:

Audio Restoration & Creative Masking

Use case: Mask imperfections or create intentional artifacts

Techniques:

Practical Workflow Examples

🎬 Sci-Fi Robot Voice (Film)

Goal: Create robotic, metallic voice effect

Settings:

  • Type: Ring Modulation
  • Preset: Ring Mod - Metallic
  • Source: Sine oscillator
  • Frequency: 80-120 Hz (adjust to voice pitch)
  • Depth: 0.7-0.9

Result: Metallic, robotic voice with inharmonic overtones

🎵 EDM Sidechain Pumping (Music)

Goal: Create sidechain compression effect on pads/bass

Settings:

  • Type: Rhythmic Gate
  • Preset: Sidechain Style
  • Source: Square oscillator
  • Frequency: Match track BPM (e.g., 2 Hz = 120 BPM)
  • Duty: 0.2-0.3 (short ON time)
  • Attack: 5 ms, Release: 50-100 ms
  • Depth: 0.8-0.9

Result: Pumping rhythm that ducks with kick drum

🎨 Glitch/Stutter Effects (Experimental)

Goal: Create digital glitch/stutter effects

Settings:

  • Type: Rhythmic Gate
  • Preset: Gate - Fast Stutter
  • Source: Square oscillator
  • Frequency: 8-15 Hz (adjust to taste)
  • Duty: 0.3-0.7 (experiment)
  • Attack/Release: 1-5 ms (very short)
  • Depth: 1.0

Result: Digital chopping/stuttering effect

Advanced Techniques

Frequency matching for musical results:
  • BPM to Hz: BPM ÷ 60 = Hz (e.g., 120 BPM = 2 Hz)
  • Musical ring mod: Set modulator to musical interval (e.g., 440 Hz × 1.5 = 660 Hz = perfect fifth)
  • Harmonic AM: Use modulator frequencies that are harmonics of carrier fundamentals
  • Polyrhythmic gating: Use non-integer frequencies (e.g., 1.333 Hz against 2 Hz)
External modulator strategies:
  • Drum loops: Create rhythmic gating synchronized to drums
  • Voice modulation: Use one voice to modulate another
  • Environmental sounds: Use nature sounds for organic modulation
  • Melodic modulation: Use melodic content as modulator for harmonic interaction

Troubleshooting Common Issues

Problem: Output too quiet or silent
Cause: Modulator has zero or near-zero values, depth too low
Solution: Increase depth, check modulator visualization, use different source
Problem: Output clipping/distorted
Cause: Depth > 1.0 for AM/Gate, or ring mod creating large amplitudes
Solution: Reduce depth, use external modulator normalization
Problem: Clicks/pops in gate output
Cause: Attack/release too short for frequency
Solution: Increase attack/release (minimum 5 ms for > 10 Hz)
Problem: Unwanted metallic sound (ring mod)
Cause: Modulator frequency creating dissonant sum/difference frequencies
Solution: Adjust frequency to musical intervals, reduce depth
Problem: "Please select exactly 2 Sound objects" error
Cause: Selected wrong number of sounds for external modulator
Solution: For external modulator: select carrier first, modulator second (2 total)

Technical Implementation Details

Modulator Generation Algorithms

SINE OSCILLATOR: Praat formula: "sin(2*pi*f*x)" Where: f = frequency in Hz, x = time in seconds Output range: -1 to 1 SQUARE OSCILLATOR: Praat formula: "if ((f*x) mod 1) < duty_cycle then 1 else -1 fi" Where: duty_cycle = ON time proportion (0-1) Output: +1 during ON, -1 during OFF TRIANGLE OSCILLATOR: Praat formula: "if ((f*x) mod 1) < 0.5 then 4*((f*x) mod 1)-1 else 3-4*((f*x) mod 1) fi" Output: Linear rise from -1 to +1, then linear fall back to -1 SAWTOOTH OSCILLATOR: Praat formula: "2*((f*x) mod 1)-1" Output: Linear rise from -1 to +1, instant drop to -1 EXTERNAL AUDIO PROCESSING: 1. Match duration to carrier (crop/pad) 2. Convert to mono if stereo 3. Normalize peak to 1.0 4. Use as modulator signal

Gate Envelope Smoothing

GATE ENVELOPE CREATION: 1. Generate square/pulse wave at frequency f 2. Convert bipolar to unipolar: (wave + 1) / 2 3. Apply low-pass filtering for attack/release SMOOTHING ALGORITHM: Smoothing frequency = 1 / max(attack, release, 0.005) Constrained to: 5 Hz ≤ smooth_freq ≤ sample_rate/4 FREQUENCY DOMAIN SMOOTHING: 1. Convert envelope to spectrum (FFT) 2. Apply low-pass filter: if freq > smooth_freq then attenuate 3. Convert back to time domain 4. Crop to original duration 5. Normalize to 0-1 range ALTERNATIVE (time domain): Could use convolution with exponential windows Current implementation uses frequency domain for simplicity

Performance Considerations

PROCESSING SPEED: Ring/AM modulation: Sample-by-sample multiplication (fast) Rhythmic gate: Additional FFT processing (slower for long files) MEMORY USAGE: Two copies of sound (carrier + modulator) Additional copies for gate envelope processing LONG FILE HANDLING: No chunking implemented - processes entire file at once For very long files (> 5 minutes), consider shorter segments VISUALIZATION: Draws 3 cycles or minimum 0.3 seconds Limited to Praat's drawing capabilities