Adaptive Transient Decomposition — User Guide

Atomic transient separation: uses LPC residual analysis and sigmoid gating to intelligently separate transient events from sustained content with mathematical precision.

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

What this does

This script implements adaptive transient decomposition — a sophisticated signal processing technique that separates audio into two distinct components: transients (sharp, impulsive events like drum hits, consonants, attacks) and residual (sustained, tonal content like vowels, pads, reverberation). The method uses Linear Predictive Coding (LPC) to model the predictable components of the signal, then applies mathematical sigmoid gating to precisely isolate transient events based on their energy characteristics.

Key Features:

What are transients? Transients are brief, high-energy events in audio that contain crucial timing and attack information. Examples: drum hits, plucked strings, speech consonants, percussion. The residual contains the sustained, tonal components: vocals, strings, pads, reverberation. Separation benefits: (1) Independent processing: Apply different effects to transients vs. sustained content. (2) Rhythmic analysis: Study timing and rhythm patterns. (3) Sound design: Create new sounds by recombining components. (4) Audio restoration: Remove or enhance specific elements. The LPC approach is particularly effective because it mathematically separates predictable (tonal) from unpredictable (transient) content based on the signal's own statistical properties.

Technical Implementation: (1) LPC analysis: Use Burg method to model predictable signal components. (2) Residual extraction: Inverse filter to obtain unpredictable content. (3) Envelope detection: Compute energy envelope of residual. (4) Noise floor estimation: Calculate background activity level. (5) Sigmoid gating: Apply mathematical soft thresholding. (6) Temporal dilation: Pad transients to preserve complete attacks. (7) Component separation: Multiply gate with residual for transients, subtract from original for residual. The system uses pure mathematical operations (no conditionals) for stability and efficiency, with careful handling of stereo signals and edge conditions.

Quick start

  1. In Praat, select exactly one Sound object (mono or stereo).
  2. Run script…Adaptive_Transient_Decomposition.praat.
  3. Set lpcOrder_ms (1.0-2.0ms for most material).
  4. Adjust integration_ms (3.0-10.0ms for envelope smoothness).
  5. Set threshold_ratio (1.5-3.0 for detection sensitivity).
  6. Choose burstPadding_ms (0.0-5.0ms for transient preservation).
  7. Click OK — processing runs with progress updates.
  8. Output: two new sounds — "originalname_transients" and "originalname_residual".
Quick tip: Start with default parameters for most material. Use smaller lpcOrder_ms (1.0-1.5) for speech and delicate transients, larger (1.8-2.2) for music with strong attacks. Lower threshold_ratio (1.5-2.0) for aggressive transient extraction, higher (2.5-3.0) for subtle detection. BurstPadding_ms = 2.0-3.0 preserves complete drum attacks, 0.0 for precise onset-only extraction. Integration_ms = 5.0 works well for most material. Processing automatically handles stereo files by processing channels independently then recombining.
Important: LPC ASSUMPTIONS — works best on signals with clear pitch structure (speech, music). Pure noise may not separate effectively. Very long transients may be partially classified as residual. Extreme parameter values may cause artifacts or insufficient separation. Stereo processing maintains phase coherence but processes channels independently. Edge padding adds 0.5s silence at boundaries to prevent artifacts. Output sounds sum to original when combined. Test on short segments first to optimize parameters for your specific material.

Transient Decomposition Theory

Linear Predictive Coding Fundamentals

LPC Mathematical Basis

Predictive modeling principle:

LPC models signal as: s[n] = Σ a[k] * s[n-k] + e[n] where: s[n] = current sample a[k] = prediction coefficients (LPC order determines how many) s[n-k] = previous samples e[n] = prediction error (residual) Burg method: Computes coefficients that minimize forward and backward prediction error while ensuring filter stability. Residual extraction: e[n] = s[n] - Σ a[k] * s[n-k] Interpretation: Predictable content → modeled by coefficients → removed from residual Unpredictable content → remains in residual → contains transients Why it works for transients: Tonal/sustained sounds are highly predictable Transients/attacks are unpredictable Residual emphasizes exactly what couldn't be predicted

Why LPC for Transient Detection?

Advantages over envelope-based methods:

Sigmoid Soft Gating System

Mathematical Smooth Thresholding

Sigmoid function properties:

Sigmoid function: f(x) = 1 / (1 + exp(-k*(x - θ))) Where: x = input value (envelope - threshold) θ = center point (0 for threshold crossing) k = steepness parameter (50 in implementation) Behavior: x << 0: f(x) ≈ 0 (below threshold → gate closed) x = 0: f(x) = 0.5 (at threshold → 50% open) x >> 0: f(x) ≈ 1 (above threshold → gate fully open) Advantages over hard thresholding: No abrupt transitions → prevents clicks Continuous derivative → smooth operation Mathematical purity → no conditionals needed Adjustable steepness → control transition sharpness Implementation: diff = envelope - (noise_floor * threshold_ratio) gate = 1 / (1 + exp(-50 * diff))

Why Sigmoid Instead of If/Then?

Artifact prevention:

🎛️ Sigmoid Gating Intuition

Soft threshold behavior:

Instead of: if envelope > threshold then 1 else 0

We use: smooth transition around threshold

Result: Natural-sounding gates without artifacts


Steepness control:

k=10: Very gradual transition (musical)

k=50: Sharp but smooth transition (default)

k=100: Nearly hard threshold (precise)

Adaptive Noise Floor System

Dynamic Threshold Calculation

Background level estimation:

Noise floor calculation: 1. Compute envelope of residual (fast RMS) 2. Heavy lowpass filtering (5Hz cutoff) 3. Result represents background activity level Threshold calculation: threshold = noise_floor * threshold_ratio Why adaptive thresholding: Different signals have different background levels Fixed thresholds don't work across material Automatic adjustment to recording conditions Consistent detection sensitivity Example scenarios: Quiet recording: low noise floor → low threshold Noisy recording: high noise floor → higher threshold Dynamic material: threshold follows background changes

Why Dynamic Thresholding?

Robustness benefits:

Temporal Padding System

Complete Transient Preservation

Burst padding rationale:

Transient temporal structure: Attack: Very brief (0.1-2ms) Decay: Short but important (2-20ms) Complete event: May span 5-50ms Problem: Envelope detection may only catch peak Solution: Temporal dilation of detection gate Padding implementation: 1. Detect transient using sharp criteria 2. Apply heavy lowpass to gate signal 3. Re-sharpen with second sigmoid 4. Result: gate opens before attack, closes after decay Mathematical process: gate_soft = lowpass(original_gate, pad_rate) gate_final = 1 / (1 + exp(-50 * (gate_soft - 0.01))) Effect: Preserves complete transient envelope

Why Temporal Padding?

Perceptual importance:

Processing Pipeline

🔧 Ten-Stage Atomic Processing

Complete signal path from input to separated components:

Stage 1: Signal Preparation & Padding

StepOperationPurpose
1.1Add 0.5s silence at start/endPrevent edge artifacts
1.2Concatenate padded signalSafe processing boundaries

Stage 2: LPC Analysis & Residual Extraction

StepOperationPurpose
2.1Compute LPC coefficients (Burg)Model predictable content
2.2Apply inverse filterExtract prediction error
2.3Obtain residual signalContains transients + noise

Stage 3: Envelope Detection

StepOperationPurpose
3.1Square residual samplesCompute instantaneous power
3.2Heavy lowpass filteringExtract energy envelope
3.3Square rootConvert back to amplitude

Stage 4: Noise Floor Estimation

StepOperationPurpose
4.1Very heavy lowpass of envelopeEstimate background level
4.2Obtain noise floor signalAdaptive threshold reference

Stage 5: Sigmoid Soft Gating

StepOperationPurpose
5.1Compute envelope - thresholdDetection difference signal
5.2Apply sigmoid functionSmooth binary decision
5.3Obtain soft gate signalTransient probability map

Stage 6: Temporal Dilation & Padding

StepOperationPurpose
6.1Lowpass gate signalTemporal smoothing
6.2Re-sharpen with sigmoidPreserve gate character
6.3Obtain final gatePadded transient detection

Stage 7: Component Separation

StepOperationPurpose
7.1Multiply residual × gateExtract transient component
7.2Obtain padded transientsComplete transient events

Stage 8: Boundary Correction

StepOperationPurpose
8.1Crop back to original durationRemove padding silence
8.2Obtain final transientsCorrect-length component

Stage 9: Residual Calculation

StepOperationPurpose
9.1Subtract transients from originalCompute sustained component
9.2Obtain final residualTonal/sustained content

Stage 10: Stereo Handling & Output

StepOperationPurpose
10.1Process channels independentlyMaintain stereo image
10.2Recombine to stereoFinal output preparation
10.3Cleanup intermediate objectsMemory management

Complete Signal Flow

INPUT SOUND (mono/stereo) ↓ PADDING: Add 0.5s silence boundaries ↓ LPC ANALYSIS: Burg method → coefficients ↓ INVERSE FILTERING: Extract residual ↓ ENVELOPE DETECTION: RMS energy calculation ↓ NOISE FLOOR ESTIMATION: Background level ↓ SIGMOID GATING: Soft threshold application ↓ TEMPORAL PADDING: Dilation + re-sharpening ↓ TRANSIENT EXTRACTION: residual × gate ↓ BOUNDARY CROP: Remove padding ↓ RESIDUAL CALCULATION: original - transients ↓ OUTPUT: "originalname_transients" + "originalname_residual"

Parameters Guide

⚙️ Complete Parameter Reference

Detailed explanation of all user-controllable parameters:

Analysis Parameters

ParameterDefaultRangeDescription
lpcOrder_ms1.61.0-3.0LPC analysis order in milliseconds
integration_ms5.02.0-20.0Envelope detection window

Detection Parameters

ParameterDefaultRangeDescription
threshold_ratio2.01.2-5.0Noise floor multiplier for detection
burstPadding_ms2.00.0-10.0Temporal padding around transients

Parameter Interactions

Key relationships:
  • lpcOrder_ms vs frequency resolution: Higher = better tonal modeling
  • integration_ms vs temporal precision: Smaller = sharper detection
  • threshold_ratio vs sensitivity: Lower = more aggressive extraction
  • burstPadding_ms vs completeness: Higher = more complete transients

Parameters work together to control separation character

Recommended Settings

🥁 Drum Extraction

Goal: Clean separation of drum hits from music

Settings:

  • lpcOrder_ms: 1.8
  • integration_ms: 3.0
  • threshold_ratio: 1.8
  • burstPadding_ms: 3.0

🎤 Speech Consonants

Goal: Precise extraction of speech transients

Settings:

  • lpcOrder_ms: 1.2
  • integration_ms: 2.5
  • threshold_ratio: 2.2
  • burstPadding_ms: 1.5

🎹 Subtle Attacks

Goal: Gentle extraction for delicate material

Settings:

  • lpcOrder_ms: 1.4
  • integration_ms: 8.0
  • threshold_ratio: 2.5
  • burstPadding_ms: 4.0

Applications

Rhythmic Analysis

Use case: Study timing and rhythm patterns

Technique: Analyze transient component for onset detection

Example: Extract drum patterns from music for tempo analysis

Sound Design

Use case: Create new sounds by recombining components

Technique: Process transients and residual independently

Example: Apply different effects to attacks vs. sustains

Audio Restoration

Use case: Clean up recordings by processing components separately

Technique: Denoise residual while preserving transients

Example: Remove background noise without affecting drum attacks

Music Production

Use case: Enhance mixes with component-based processing

Technique: Independent control of transients and sustains

Example: Add punch to drums without affecting tonal balance

💡 Creative Applications

Advanced techniques:

  • Transient shaping: Modify attack characteristics independently
  • Hybrid synthesis: Combine transients from one sound with sustains from another
  • Rhythmic gating: Use transient component to trigger other processes
  • Multiband separation: Apply to frequency bands for finer control

Troubleshooting Common Issues

Problem: Incomplete transient extraction
Cause: Threshold too high, LPC order too large
Solution: Lower threshold_ratio, reduce lpcOrder_ms
Problem: Tonal content in transients
Cause: LPC order too small, threshold too low
Solution: Increase lpcOrder_ms, raise threshold_ratio
Problem: Choppy-sounding transients
Cause: Insufficient padding, too sharp gating
Solution: Increase burstPadding_ms, use gentler settings
Problem: Phase issues in stereo
Cause: Extreme parameter differences between channels
Solution: Use moderate settings, check mono compatibility