Math Operations Between Sounds — User Guide

Comprehensive audio signal mathematics: 18 curated presets and 30+ operations for creative mixing, modulation, distortion, and synthesis effects through mathematical combination of two audio signals.

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

What this does

This script implements mathematical operations between two audio signals — a comprehensive toolkit for sample-by-sample mathematical combination of two sounds. With 18 curated presets and over 30 individual operations across four categories (Basic, Modulation, Non-linear, Advanced), it enables everything from simple mixing to complex synthesis effects, all through mathematical formulas applied to audio waveforms.

Key Features:

What is audio signal mathematics? Every digital audio signal is an array of numbers (samples) representing amplitude over time. Mathematical operations: (1) Sample-by-sample: For each time point t, apply operation to samples s1[t] and s2[t]. (2) Linear operations: Addition, subtraction, multiplication (ring modulation), division. (3) Non-linear operations: Waveshaping, distortion, bitcrushing, wavefolding. (4) Modulation operations: Amplitude modulation (AM), frequency modulation (FM) simulation. (5) Advanced transforms: Domain changes, vector operations, chaotic systems. Applications: Sound design (creating new timbres), audio effects (modulation, distortion), synthesis (FM, waveshaping), experimental composition (mathematical sound combinations).

Technical Implementation: (1) Input validation: Check exactly 2 sounds selected, matching sample rates. (2) Duration matching: Extract equal-length portions from both sounds. (3) Preset logic: 18 presets configure specific operation combinations. (4) Priority system: Advanced transforms override non-linear, which override modulation, which override basic. (5) Formula application: Praat's Formula command applies mathematical expressions to sample arrays. (6) Output processing: Scaling and normalization. (7) Cleanup: Remove temporary objects, select result. Key insight: All audio effects fundamentally reduce to mathematical operations on sample values — this script exposes those operations directly.

Quick start

  1. In Praat Objects window, select two Sound objects (order matters: Sound1 then Sound2).
  2. Open script: math_operations_between_sounds.praat
  3. Choose approach:
    • Option A (Presets): Select from 18 curated presets (Clean Add to Rectify Distortion)
    • Option B (Custom): Set Preset = "Custom", then configure operations manually
  4. If using Custom mode, configure four operation categories:
    • Basic operation: Add, Subtract, Multiply, etc. (9 options)
    • Modulation operation: AM, FM, tremolo, etc. (8 options)
    • Non-linear operation: Wavefold, bitcrush, frequency shift, etc. (7 options)
    • Advanced operation: Sqrt domain, vector morph, chaotic, etc. (7 options)
  5. Adjust parameters:
    • Modulation_depth: Strength of modulation effects (0.1-5.0)
    • Nonlinear_intensity: Intensity of non-linear effects (0.0-2.0)
    • Output_scaling: Overall output volume (0.1-5.0)
    • Normalize_output: Auto-normalize peak to 0.99 (recommended)
  6. Click OK — script processes, creates result, auto-plays
  7. Output named "Sound1_operation_Sound2" appears in Objects window
Quick tip: Start with presets to explore possibilities: Clean Add for simple mixing, Clean Multiply for ring modulation, Tremolo Effect for amplitude modulation, Crunch Mod for distortion. For custom operations: Priority system: Only one operation from highest category applies (Advanced > Non-linear > Modulation > Basic). Parameter ranges: modulation_depth 0.5-2.0 typical, nonlinear_intensity 0.3-1.0 typical. Sound selection: Try contrasting sounds (voice + noise, instrument + rhythm). Auto-truncation: Output uses shortest sound's duration. Result naming: Shows operation type for easy identification.
Important: EXACTLY 2 SOUNDS REQUIRED — selection order matters (Sound1 is "self" in formulas). SAMPLE RATES MUST MATCH — script checks and exits if different. DURATION HANDLING: Uses shortest sound's length (longer sound truncated). PRIORITY SYSTEM: Advanced operations override all others — if you set an advanced operation, basic/modulation/non-linear are ignored. DIVISION WARNING: Basic division includes protection against divide-by-zero (adds 1e-10). NON-LINEAR EFFECTS: Can create extreme distortion/clipping — use normalize_output. MODULATION DEPTH: High values (>3.0) can create extreme modulation. BITCRUSH EFFECT: Uses 8-bit quantization (rounding to 1/8 increments). WAVEFOLDING: Creates aliasing/foldover distortion at high intensities.

Signal Math Theory

Digital Audio Fundamentals

📊 Audio as Numerical Arrays

Digital audio representation:

Sound 1: s1[t] = array of samples at times t = 0, Δt, 2Δt, ..., T Sound 2: s2[t] = array of samples at times t = 0, Δt, 2Δt, ..., T Where: Δt = 1 / sample_rate (e.g., 1/44100 ≈ 0.0000227s for 44.1kHz) T = duration in seconds Samples typically normalized to [-1.0, 1.0] range Example (simplified): s1 = [0.5, 0.3, -0.1, 0.8, ...] s2 = [0.2, 0.4, 0.6, -0.3, ...]

Mathematical operations (sample-by-sample):

Addition: result[t] = s1[t] + s2[t] Subtraction: result[t] = s1[t] - s2[t] Multiplication: result[t] = s1[t] × s2[t] # Ring modulation Division: result[t] = s1[t] ÷ (s2[t] + ε) # ε small to avoid /0 Example with t=0: s1[0] = 0.5, s2[0] = 0.2 Addition: 0.5 + 0.2 = 0.7 Multiply: 0.5 × 0.2 = 0.1

Amplitude considerations:

  • Addition: Can exceed [-1, 1] range → potential clipping
  • Multiplication: Stays within range (product of numbers ≤1)
  • Normalization: Scale peak to 0.99 prevents clipping
  • DC offset: Operations can introduce DC component

Priority Processing System

🔝 Operation Hierarchy

Four-level priority system:

  1. Advanced Transforms (highest priority)
  2. Non-linear Operations
  3. Modulation Operations
  4. Basic Operations (lowest priority)

Implementation logic:

IF advanced_operation > 1 (not "None") THEN Apply advanced operation formula ELSIF nonlinear_operation > 1 THEN Apply non-linear operation formula ELSIF modulation_operation > 1 THEN Apply modulation operation formula ELSE Apply basic operation formula ENDIF

Design rationale:

  • Prevents conflicting operations: Only one formula applied
  • Advanced overrides basic: Complex transforms take precedence
  • Clear mental model: User knows which operation will execute
  • Preset-friendly: Presets set specific operations without conflict

Example scenario:

  • User sets: Basic=Add, Modulation=AM, Non-linear=Wavefold, Advanced=Sqrt
  • Only Sqrt domain mix executes (highest priority)
  • Other three operations are ignored
  • To use multiple effects, chain operations in separate passes

Mathematical Foundations

KEY MATHEMATICAL CONCEPTS: 1. LINEAR OPERATIONS: • Addition: y = s1 + s2 • Subtraction: y = s1 - s2 • Multiplication: y = s1 × s2 (ring modulation) • Average: y = (s1 + s2) / 2 2. MODULATION OPERATIONS: • AM (Amplitude Modulation): y = s1 × (carrier) Example: y = s1 × sin(2πft) where f from s2 • FM (Frequency Modulation simulation): y = sin(modulator) × carrier Note: True FM requires phase integration, this is approximation 3. NON-LINEAR OPERATIONS: • Waveshaping: y = f(s1, s2) where f is non-linear • Wavefolding: y = fold(s1 + s2, threshold) creates aliasing • Bitcrushing: y = quantize(s1 + s2, steps) adds quantization noise • Rectification: y = |s1| - |s2| (full-wave rectifier effect) 4. ADVANCED TRANSFORMS: • Domain transforms: sqrt, log, exp change value distribution • Vector operations: weighted combinations, morphing • Chaotic systems: logistic map, random processes • Phase manipulations: phase vocoder simulation

Amplitude Ranges and Normalization

Amplitude Management:
  • Input range: Typically [-1.0, 1.0] for normalized audio
  • Operation effects:
    • Addition: Can produce [-2.0, 2.0] range
    • Multiplication: Produces [-1.0, 1.0] range (product of ≤1 values)
    • Non-linear ops: Can exceed original range
  • Normalization: Scale peak to 0.99 (just below clipping)
  • Output_scaling: Multiply result by this factor before normalization
  • Practical tip: Always use normalize_output=1 unless intentionally creating clipped/distorted sound

Presets Gallery

18 Curated Presets

1. Clean Add

Operation: Basic Addition

Effect: Simple mixing of two sounds

Use: Basic audio mixing, layering

Result: s1 + s2

2. Clean Multiply (Ring Mod)

Operation: Basic Multiplication

Effect: Classic ring modulation

Use: Metallic, bell-like tones

Result: s1 × s2

3. Tremolo Effect

Operation: Modulation: Tremolo

Effect: Amplitude modulation

Use: Rhythmic volume changes

Result: s1 × (1 + s2 × 0.5)

4. Crunch Mod (Arctan)

Operation: Modulation: Arctan

Effect: Soft clipping distortion

Use: Warm overdrive, saturation

Result: (2/π) × arctan(s1 × s2 × 20)

5. FM Synthesis

Operation: Modulation: FM-like

Effect: Frequency modulation simulation

Use: Synthetic, complex timbres

Result: sin(s1 × 5π) × s2

6. Double FM

Operation: Modulation: Double FM

Effect: Dual sine modulation

Use: Complex metallic tones

Result: sin(s1 × 7.5π) × sin(s2 × 7.5π)

7. Wavefold Distortion

Operation: Non-linear: Wavefold

Effect: Aliasing/foldover distortion

Use: Digital grit, bit-reduction

Result: fold(s1 + s2, threshold=1.3)

8. Bitcrush Lo-Fi

Operation: Non-linear: Bitcrush 8-bit

Effect: 8-bit quantization

Use: Lo-fi, retro video game sounds

Result: round((s1 + s2) × 8) ÷ 8

9. Frequency Shifter

Operation: Non-linear: Freq shift sim

Effect: Pitch shifting illusion

Use: Unnatural pitch effects

Result: s1 × cos(2π × s2 × 120)

10. Hard Sync

Operation: Non-linear: Hard sync sim

Effect: Oscillator sync simulation

Use: Aggressive synth tones

Result: Hard sync algorithm

11. Chaotic Mix

Operation: Advanced: Logistic chaos

Effect: Chaotic system behavior

Use: Unpredictable, evolving textures

Result: (s1 + s2) × (3.5 - 3.5 × |s1| × |s2|)

12. Spectral Blur

Operation: Non-linear: Soft normalize mix

Effect: Spectral averaging, blurring

Use: Smearing, time-stretching effect

Result: (s1 + s2) ÷ (1 + 0.8 × (|s1| + |s2|))

13. Phase Vocoder-like

Operation: Advanced: Pseudo phase-vocoder

Effect: Phase manipulation simulation

Use: Time-stretch/pitch-shift effects

Result: s1 × cos(50π × s2) + s2 × sin(50π × s1)

14. Granular Scatter

Operation: Advanced: Random scatter

Effect: Randomized mixing

Use: Granular texture effects

Result: (s1 + s2) × (0.8 + 0.4 × random)

15. Sqrt Domain

Operation: Advanced: Sqrt domain mix

Effect: Square root compression

Use: Dynamic range compression

Result: √|s1| × √|s2| × 10

16. Vector Morph

Operation: Advanced: Vector morph

Effect: Linear crossfade/morphing

Use: Smooth transitions between sounds

Result: s1 × 0.5 + s2 × 0.5

17. Rectify Distortion

Operation: Advanced: Rectify & mix

Effect: Full-wave rectification

Use: Distortion, octave effects

Result: |s1| - |s2|

18. Custom (manual settings)

Operation: User-defined combination

Effect: Whatever you configure

Use: Experimental exploration

Result: Based on your settings

Preset Selection Guide

By Desired Effect:
Desired Effect Recommended Preset Notes
Simple mixing Clean Add (1) Basic audio combination
Metallic/robotic Clean Multiply (2) Classic ring modulation
Rhythmic pulsing Tremolo Effect (3) Use rhythmic sound as s2
Warm distortion Crunch Mod (4) Arctan soft clipping
Synthetic tones FM Synthesis (5) FM-like timbres
Digital grit Bitcrush Lo-Fi (8) 8-bit quantization
Pitch effects Frequency Shifter (9) Unnatural pitch shifts
Evolving textures Chaotic Mix (11) Unpredictable behavior
Smooth transitions Vector Morph (16) Linear crossfade
Distortion/octaves Rectify Distortion (17) Full-wave rectification

Operations Guide

Basic Operations (9 Options)

➕ Basic Arithmetic

Operation Formula Effect Notes
Add (+) s1 + s2 Simple mixing Can clip, use normalization
Subtract (-) s1 - s2 Difference, phase cancellation Can create nulls when similar
Multiply (*) s1 × s2 Ring modulation Classic metallic/robotic effect
Divide (/) s1 ÷ (s2 + ε) Ratio, extreme dynamics ε=1e-10 prevents divide-by-zero
Average (s1 + s2) ÷ 2 Equal mix Same as Add then halve
Minimum min(s1, s2) Lower envelope Keeps minimum of each sample pair
Maximum max(s1, s2) Upper envelope Keeps maximum of each sample pair
Absolute difference |s1 - s2| Magnitude of difference Always positive, rectified
XOR-like sign-based mixing Phase-aware mixing Mixes magnitudes, inverts when signs differ

Use cases:

  • Add/Average: Basic audio mixing
  • Multiply: Ring modulation for metallic sounds
  • Subtract: Phase cancellation, noise reduction
  • Min/Max: Envelope extraction, gating
  • Absolute diff: Change detection, novelty

Modulation Operations (8 Options)

📡 Modulation Effects

Operation Formula Effect modulation_depth
AM: sin(S2) s1 × (0.5 + 0.5×sin(s2×10π×depth)) Amplitude modulation with sine Controls modulation frequency
AM: cos(S2) s1 × (0.5 + 0.5×cos(s2×10π×depth)) AM with cosine (90° phase shift) Same as above, different phase
FM-like: sin(S1)×S2 sin(s1×5π×depth) × s2 Frequency modulation simulation Controls modulation index
FM-like: cos(S1)×S2 cos(s1×5π×depth) × s2 FM with cosine carrier Different harmonic structure
Double FM sin(s1×5π×depth) × sin(s2×5π×depth) Dual sine modulation Complex metallic tones
Soft clip: tan (2/π)×arctan(s1×s2×10×depth) Arctan soft clipping Distortion amount
Power mod sign(s1)×|s1|^(1+s2×depth) Dynamic waveshaping Exponent control
Tremolo s1 × (1 + s2×depth) Simple amplitude modulation Tremolo depth

Parameter guidance:

  • modulation_depth = 0.5: Subtle modulation
  • modulation_depth = 1.0: Standard modulation
  • modulation_depth = 2.0: Strong modulation
  • modulation_depth = 5.0: Extreme modulation (may alias)

Non-linear Operations (7 Options)

🌀 Non-linear Transformations

Operation Description Effect nonlinear_intensity
Freq shift sim s1 × cos(2π×s2×100×intensity) Pitch shifting simulation Shift amount
AM depth control s1 × (1 + s2×intensity) Dynamic AM depth Depth modulation
Wavefold Fold s1+s2 at threshold Aliasing/foldover distortion Folding threshold
Hard sync sim Oscillator sync simulation Aggressive synth reset Sync strength
Bitcrush 8-bit round((s1+s2)×8) ÷ 8 8-bit quantization Fixed (not used)
Vector crossfade s1×(1-i×|s2|) + s2×i Amplitude-dependent crossfade Crossfade amount
Soft normalize mix (s1+s2) ÷ (1+i×(|s1|+|s2|)) Automatic gain control Compression amount

Technical details:

  • Wavefold: Creates foldover distortion when sum exceeds threshold
  • Bitcrush: 8-bit = 256 levels (round to nearest 1/8)
  • Hard sync: When |s2| > |s1|×intensity, reset to s2's sign
  • Soft normalize: Divides by sum of magnitudes, prevents clipping

Advanced Operations (7 Options)

🚀 Advanced Transforms

Operation Formula Effect Mathematical Basis
Sqrt domain mix √|s1| × √|s2| × 10 Square root compression Dynamic range reduction
Exp domain mix exp(ln|s1| + ln|s2|) × 0.1 Logarithmic mixing Multiplicative in log domain
Vector morph s1×(1-d) + s2×d Linear interpolation Vector space morphing
Logistic chaos (s1+s2)×(3.5-3.5×|s1|×|s2|) Chaotic system Logistic map variation
Rectify & mix |s1| - |s2| Full-wave rectification Absolute value difference
Pseudo phase-vocoder s1×cos(50π×s2) + s2×sin(50π×s1) Phase manipulation Trigonometric recombination
Random scatter (s1+s2)×(0.8+0.4×random) Randomized gain Stochastic process

Advanced concepts:

  • Domain transforms: Change mathematical domain (linear→sqrt→log)
  • Chaotic systems: Simple logistic map creates unpredictable behavior
  • Phase manipulation: Simulates phase vocoder time-stretching
  • Vector operations: Treat samples as vectors in n-dimensional space

Operation Categories

Category 1: Basic Arithmetic

🔢 Linear Operations

Characteristics:

  • Linearity: f(a×s1 + b×s2) = a×f(s1) + b×f(s2)
  • Predictability: Output directly proportional to inputs
  • Simplicity: Easy to understand mathematically
  • Range effects: Addition can exceed [-1,1], multiplication stays within

Audio effects:

  • Add/Subtract: Mixing, phase cancellation
  • Multiply: Ring modulation (sum/difference frequencies)
  • Min/Max: Envelope following, gating
  • Average: Equal-power mixing

Mathematical properties:

Addition: Commutative: s1+s2 = s2+s1 Associative: (s1+s2)+s3 = s1+(s2+s3) Multiplication: Commutative: s1×s2 = s2×s1 Associative: (s1×s2)×s3 = s1×(s2×s3) Distributes over addition: s1×(s2+s3) = s1×s2 + s1×s3 Ring modulation (multiplication) creates sum and difference frequencies: If s1 = sin(2πf1t) and s2 = sin(2πf2t) Then s1×s2 = 0.5[cos(2π(f1-f2)t) - cos(2π(f1+f2)t)]

Category 2: Modulation Operations

📻 Signal Modulation

Core concept: Use one signal to modify parameter of another

Types of modulation:

  • AM (Amplitude Modulation): Carrier amplitude varied by modulator
  • FM (Frequency Modulation): Carrier frequency varied by modulator
  • Tremolo: Low-frequency AM (typically < 20Hz)
  • Waveshaping: Non-linear function applied to signal

Mathematical forms:

True AM: y(t) = A[1 + m×s2(t)] × s1(t) Where m = modulation index (0-1) True FM: y(t) = A × sin[2πf_c t + β∫s2(τ)dτ] Where β = modulation index, ∫ = integration (Script uses approximation: sin(s1) × s2) Tremolo: y(t) = s1(t) × [1 + depth×s2(t)] Typically s2 is low-frequency oscillator

Sidebands creation:

  • AM: Creates carrier ± modulator frequencies
  • FM: Creates infinite sidebands at carrier ± n×modulator
  • Ring modulation: Creates sum and difference frequencies (no carrier)

Category 3: Non-linear Operations

⚡ Non-linear Transformations

Core concept: Operations that don't satisfy superposition principle

Characteristics:

  • Non-linearity: f(a×s1 + b×s2) ≠ a×f(s1) + b×f(s2)
  • Harmonic generation: Creates new frequencies not in input
  • Memoryless: Output at time t depends only on input at time t
  • Waveshaping: Apply function f(x) to signal

Common non-linear functions:

Clipping: f(x) = min(max(x, -threshold), threshold) Rectification: f(x) = |x| Quantization: f(x) = round(x × steps) / steps (bitcrush) Wavefolding: f(x) = fold(x, threshold) (mirrors beyond threshold) Arctan: f(x) = (2/π) × arctan(gain × x) (soft clipping)

Harmonic distortion:

  • Symmetrical non-linearity: Creates odd harmonics
  • Asymmetrical non-linearity: Creates even and odd harmonics
  • Quantization: Creates harmonic distortion + noise
  • Wavefolding: Creates aliasing/foldover distortion

Category 4: Advanced Transforms

🧮 Advanced Mathematical Operations

Core concept: Complex mathematical transformations beyond basic signal processing

Types of transforms:

  • Domain changes: Square root, logarithmic, exponential domains
  • Vector operations: Treat signals as vectors, apply linear algebra
  • Chaotic systems: Simple deterministic chaos
  • Stochastic processes: Introduce randomness
  • Phase manipulation: Simulate phase vocoder operations

Mathematical foundations:

Domain transforms: Square root: compresses high amplitudes, expands low Logarithm: compresses dynamic range Exponential: expands dynamic range Vector operations: Dot product: s1·s2 = Σ s1[i]×s2[i] Crossfade: α×s1 + (1-α)×s2 (convex combination) Chaotic systems: Logistic map: x_{n+1} = r × x_n × (1 - x_n) Chaos when r > ~3.57

Audio effects:

  • Dynamic range compression: Square root/logarithm
  • Morphing: Vector interpolation between sounds
  • Texture generation: Chaotic systems create evolving sounds
  • Granular effects: Randomized mixing

Applications

Sound Design & Synthesis

Use case: Create new timbres from existing sounds

Techniques:

Example workflow:

  1. Sound1: Vocal recording
  2. Sound2: 100Hz sine tone (create in Praat)
  3. Preset: Clean Multiply (ring modulation)
  4. Result: Robotic, metallic vocal effect
  5. Variation: Try different modulator frequencies (50Hz, 200Hz, 440Hz)

Audio Effects Processing

Use case: Create custom audio effects through mathematical combination

Effect types:

Practical example - Tremolo:

1. Create LFO in Praat: Create Sound from formula: "sin(2*pi*5*x)" # 5Hz sine 2. Select: Sound1 (music/voice) + Sound2 (5Hz sine) 3. Preset: Tremolo Effect Or custom: modulation_operation = "Tremolo", modulation_depth = 0.7 4. Result: Audio with 5Hz amplitude modulation

Experimental Composition

Use case: Algorithmic music creation through mathematical operations

Techniques:

Composition strategy:

  1. Create sound palette (6-8 source sounds)
  2. Systematically combine using different operations
  3. Vary operation parameters over time (multiple script runs)
  4. Layer results for complex textures
  5. Use output as material for further processing

Audio Restoration & Analysis

Use case: Extract information through mathematical comparison

Techniques:

Example - Noise reduction analysis:

Goal: Analyze noise component in recording 1. Sound1: Noisy recording 2. Sound2: Noise sample (silence or isolated noise) 3. Operation: Absolute difference 4. Result: Magnitude of signal beyond noise floor 5. Analysis: Visualize result to see where signal exceeds noise

Educational Demonstrations

Use case: Teach digital audio and signal processing concepts

Learning objectives:

Classroom exercise:

  1. Create two simple sine waves at different frequencies
  2. Try all basic operations, listen to results
  3. Explain frequency domain effects (sum/difference tones)
  4. Move to more complex sounds, explore non-linear operations
  5. Discuss musical/sound design applications

Practical Example Configurations

🎤 Vocal Processing Chain

Goal: Transform dry vocal into textured, effected sound

Step 1 - Add warmth:

  • Sound1: Dry vocal
  • Sound2: Low sine tone (80Hz, amplitude 0.3)
  • Operation: Add
  • Effect: Adds bass warmth

Step 2 - Add modulation:

  • Take result from Step 1
  • Sound2: 0.5Hz sine (LFO)
  • Preset: Tremolo Effect (depth=0.3)
  • Effect: Subtle amplitude modulation

Step 3 - Add grit:

  • Take result from Step 2
  • Sound2: White noise (low amplitude)
  • Preset: Crunch Mod (depth=0.5)
  • Effect: Subtle distortion/saturation

🎹 Synthetic Texture Creation

Goal: Create evolving pad sound from simple sources

Sources:

  • Sound1: 220Hz sine wave (A3)
  • Sound2: 277Hz sine wave (C#4)

Process:

  1. First pass: Preset = Double FM (creates metallic tones)
  2. Second pass: Take result + new 329Hz sine (E4), Preset = Vector Morph (creates evolving mix)
  3. Third pass: Take result + filtered noise, Preset = Spectral Blur (adds texture)
  4. Final: Three-layer composite creates rich, evolving pad

🔊 Drum Processing

Goal: Add punch and character to drum loop

Technique 1 - Parallel compression:

  • Sound1: Original drum loop
  • Sound2: Compressed version of same loop
  • Operation: Add (parallel compression)
  • Adjust output_scaling to control blend

Technique 2 - Bitcrush effect:

  • Sound1: Drum loop
  • Sound2: Same loop at lower amplitude (0.3)
  • Preset: Bitcrush Lo-Fi
  • Result: Drums with lo-fi grit blended in

Technique 3 - Rhythmic gating:

  • Sound1: Drum loop
  • Sound2: Rhythmic pulse (e.g., 16th notes)
  • Operation: Multiply (ring modulation)
  • Result: Rhythmically gated drums

Complete Workflow

Step-by-Step Script Execution

🔧 Processing Pipeline

Phase 1: Input Validation

1. Check exactly 2 Sound objects selected 2. Verify selection order: Sound1 (first), Sound2 (second) 3. Get properties: names, sample rates, durations 4. Check sample rates match (critical for sample-by-sample math) 5. Calculate min_duration = minimum of both durations

Phase 2: Preset Logic

if preset > 1 (not "Custom"): 1. Reset all operations to "None" (1) 2. Force basic operation to "Add" (1) as fallback 3. Apply preset-specific settings: - Clean Add: operation = 1 - Clean Multiply: operation = 3 - Tremolo: modulation_operation = 9, depth = 0.5 - etc. for all 18 presets else (preset = 1 "Custom"): Use user-selected operations from form

Phase 3: Duration Matching

1. Extract equal-length portions: sound1_part = Extract part: 0, min_dur, "rectangular", 1, "no" sound2_part = Extract part: 0, min_dur, "rectangular", 1, "no" 2. Create result container: Copy sound1_part to result (will be modified) 3. Set result name: if preset = Custom: name1_operation_name2 else: name1_presetname_name2

Phase 4: Mathematical Processing

Priority order (highest to lowest): 1. Advanced operations (if selected) 2. Non-linear operations (if advanced not selected) 3. Modulation operations (if neither above selected) 4. Basic operations (if none above selected) Implementation: selectObject: result if advanced_operation > 1: Formula... [advanced formula] elsif nonlinear_operation > 1: Formula... [non-linear formula] elsif modulation_operation > 1: Formula... [modulation formula] else: Formula... [basic formula]

Phase 5: Post-Processing

1. Apply output_scaling: if output_scaling ≠ 1.0: Formula... self * output_scaling 2. Normalize (if selected): if normalize_output: Scale peak: 0.99 3. Play result (auto-playback)

Phase 6: Cleanup & Finalization

1. Remove temporary objects: removeObject: sound1_part, sound2_part 2. Select result object for user 3. Script complete

Sound Selection Strategies

Pairing Sounds for Different Effects:
Desired Effect Sound1 (Carrier/Base) Sound2 (Modulator/Effect) Recommended Operation
Robotic voice Speech Sine tone (100-300Hz) Multiply (Ring Mod)
Tremolo Any audio Low sine (1-10Hz) Tremolo (modulation)
Metallic texture Complex sound High sine (1000Hz+) Double FM
Lo-fi effect Clean audio Noise or same audio Bitcrush
Phase cancellation Recording Same recording shifted Subtract
Dynamic morph Sound A Sound B Vector Morph
Warm distortion Audio source Same audio (louder) Crunch Mod (Arctan)

Troubleshooting Common Issues

Problem: "Please select exactly 2 Sound objects"
Causes: 0, 1, or 3+ sounds selected
Solutions: • Select exactly 2 Sound objects
• Check Objects window selection count
• Use Ctrl+click to select multiple in Praat
Problem: "Sampling rates must match"
Causes: Sounds have different sample rates (e.g., 44100Hz vs 48000Hz)
Solutions: • Resample one sound to match the other
• Use Praat's Convert → Resample...
• Choose common rate (e.g., 44100Hz for both)
Problem: Operation not working as expected
Causes: Priority system, operation override, parameter issues
Solutions: • Check priority: Advanced > Non-linear > Modulation > Basic
• If advanced operation selected, others ignored
• Verify operation parameters (depth, intensity)
• Try preset first to confirm script works
Problem: Output is distorted/clipped
Causes: Amplitude exceeded range, no normalization
Solutions: • Enable normalize_output (default is on)
• Reduce output_scaling (try 0.5 instead of 1.0)
• Use non-linear operations that stay in range (multiply, bitcrush)
• For addition, ensure input amplitudes are low (e.g., 0.5 each)
Problem: Result is silent or very quiet
Causes: Phase cancellation, division by large values, low output_scaling
Solutions: • For subtraction: Similar sounds can cancel
• For division: Divisor may be large → small result
• Check output_scaling (increase to 2.0-5.0)
• Try different sound pairings

Advanced Workflow: Chaining Operations

Creating Complex Effects Through Multiple Passes:

Example: Rich modulated texture:

Pass 1: FM Synthesis Sound1: Voice recording Sound2: 150Hz sine Preset: FM Synthesis (5) Result1: voice_FM_sine Pass 2: Add noise texture Sound1: Result1 from Pass 1 Sound2: Filtered noise Operation: Add Result2: voice_FM_sine_noise Pass 3: Bitcrush effect Sound1: Result2 from Pass 2 Sound2: Same at lower amplitude Preset: Bitcrush Lo-Fi (8) Final: Complex, textured, lo-fi modulated voice

Workflow tips:

  • Save intermediate results: Rename clearly (e.g., "step1_FM", "step2_addNoise")
  • Vary parameters: Use different modulation_depth values each pass
  • Combine operation types: Linear + non-linear + modulation
  • Use normalization: Each pass can normalize to maintain level
  • Experiment systematically: Document settings for reproducible results