Envelope Application — User Guide

Dynamic amplitude shaping: applies mathematical envelope functions to audio with real-time visualization, comprehensive parameter control, and professional amplitude modulation.

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 comprehensive envelope application — a sophisticated amplitude modulation system that applies mathematical envelope functions to audio with real-time visualization. Unlike simple gain changes, this method provides: (1) 8 envelope types: Linear, Exponential, Sine, Welch, Step, Linen, Percussive, and full ADSR. (2) Mathematical precision: Exact formula-based envelope generation. (3) Real-time visualization: Three-panel display showing original, envelope, and result. (4) Parameter flexibility: Customizable curves, timing, and levels for each envelope type. (5) Professional workflow: Interactive parameter dialogs with sensible defaults. Process analyzes selected sound, generates envelope based on mathematical formulas, applies via IntensityTier multiplication, and displays comprehensive visualization. Result: precise amplitude control with immediate visual feedback and professional-quality dynamic shaping.

Key Features:

What is envelope application? Traditional amplitude control: Simple volume changes or basic fades. Advanced envelope application: Mathematical shaping of amplitude over time using precise formulas and professional paradigms. Key characteristics: (1) Mathematical basis: Each envelope type has exact mathematical definition. (2) Visual feedback: Immediate graphical representation of the shaping. (3) Parameter control: Fine adjustment of timing, levels, and curves. (4) Professional standards: Implements industry-standard envelope types like ADSR. Advantages: (1) Precision: Exact control over amplitude shaping. (2) Reproducibility: Same parameters yield identical results. (3) Visual learning: See the envelope before hearing the result. (4) Creative flexibility: Wide range of shaping possibilities. Use cases: Audio production (dynamic control, fades), sound design (amplitude shaping, effects), music composition (phrase shaping), film/TV (level automation), scientific audio (precise amplitude modulation), education (envelope demonstration).

Technical Implementation: (1) Sound analysis: Extract duration and sampling frequency from selection. (2) Envelope selection: User chooses from 8 envelope types via dialog. (3) Parameter collection: Context-sensitive dialogs for each envelope type. (4) Formula generation: Build mathematical formula string for visualization. (5) IntensityTier creation: Generate smooth envelope curve with 200 control points. (6) Application: Multiply original sound by envelope using IntensityTier. (7) Visualization: Three-panel display showing original, envelope shape, and result. Key insight: Different envelope types provide distinct perceptual effects—linear fades sound neutral, exponential fades sound more natural, complex envelopes like ADSR create articulated amplitude contours.

Quick start

  1. In Praat, select exactly one Sound object.
  2. Run script…envelope_application.praat.
  3. Choose Envelope type from 8 options.
  4. Adjust parameters in the context-sensitive dialog that appears.
  5. Click OK — envelope applied and three-panel visualization displayed.
  6. Result named "originalname_enveloped" appears in Objects window.
Quick tip: Start with Linear or Exponential envelopes for simple fades. Use Sine or Welch for smooth, natural-sounding transitions. Step envelopes create instant level changes for dramatic effects. Linen provides simplified attack-sustain-release for quick shaping. Perc is optimized for percussive sounds with fast attacks. ADSR offers full control for complex amplitude articulation. The three-panel display shows exactly what's happening: original sound (top), envelope shape (middle), and result (bottom). Parameters automatically scale to your sound's duration — values are in seconds relative to your selection. Processing preserves original quality while applying precise amplitude modulation.
Important: AMPLITUDE MULTIPLICATION — envelope multiplies existing amplitude (destructive operation). Very aggressive envelopes may cause excessive gain reduction or unexpected silence. ADSR and Linen envelopes with long times may extend beyond sound duration — adjust timing parameters accordingly. The visualization uses 1000 Hz sampling for display clarity — this doesn't affect the actual envelope application quality. IntensityTier application converts to dB scale — very small amplitude values may approach silence. Always check the visualization to ensure the envelope shape matches your intentions. For complex sounds, listen carefully to ensure the envelope works musically — mathematical precision doesn't always equal perceptual ideal. The script creates temporary objects but cleans them up automatically.

Envelope Theory

Amplitude Envelope Fundamentals

Mathematical Definition

Envelope as time-varying gain:

General envelope function: output(t) = input(t) × envelope(t) Where: t = time (0 to duration) envelope(t) = amplitude multiplier at time t envelope(t) ∈ [0,1] typically Key envelope properties: - Continuity: Most envelopes are continuous functions - Range: Typically [0,1] for amplitude multiplication - Shape: Determines perceptual character of amplitude change - Parameters: Control timing, levels, and curvature Implementation approach: Generate envelope(t) as mathematical function Sample at audio rate for application Visualize for user feedback Apply via multiplication in time domain

Why Multiple Envelope Types?

Perceptual differences:

Envelope Mathematics

Core Mathematical Formulas

Fundamental envelope equations:

Linear envelope: envelope(t) = start_level + (end_level - start_level) × (t/duration) Exponential envelope: envelope(t) = start_level × (end_level/start_level)^(t/duration) Sine envelope: envelope(t) = start_level + (end_level - start_level) × [1 - cos(π × t/duration)]/2 Welch envelope (parabolic): IF t/duration < 0.5: envelope(t) = start_level + (end_level - start_level) × [1 - (1 - 2t/duration)²] ELSE: envelope(t) = end_level - (end_level - start_level) × [1 - (2t/duration - 1)²] Step envelope: IF t < step_time: envelope(t) = level_before ELSE: envelope(t) = level_after Curve parameter interpretation: Positive curves: concave shape (fast start) Negative curves: convex shape (slow start) Magnitude controls curvature intensity

Mathematical Properties

Continuity and smoothness:

Linear: C⁰ continuous (position), C¹ discontinuous (velocity)
Constant slope throughout
Perceptually mechanical, predictable

Exponential: C⁰ continuous
Changing slope, natural-sounding
Matches human loudness perception

Sine: C¹ continuous (smooth velocity)
Smooth acceleration and deceleration
Musical, pleasing to the ear

Welch: C¹ continuous
Parabolic segments meet smoothly
Very smooth, professional quality

Step: C⁻¹ discontinuous (infinite derivative)
Instant change, dramatic effect
Can cause clicks if not at zero-crossings

Linen/ADSR: Piecewise continuous
Multiple segments with controlled transitions
Articulated, instrument-like behavior

🎵 Perceptual Intuition

Linear fades:

Sound changes at constant rate

Perceptually neutral but can sound mechanical

Good for technical applications

Exponential fades:

Sound changes faster at beginning/end

Matches human loudness perception

Sounds more natural, musical

Sine fades:

Smooth acceleration and deceleration

Musical, pleasing contour

Ideal for musical phrases

Professional Envelope Paradigms

ADSR Envelope Structure

The industry standard for amplitude articulation:

ADSR segments: Attack: Sound reaches peak amplitude Time: 0 → attack_time Level: 0 → peak_level Decay: Sound falls to sustain level Time: attack_time → attack_time + decay_time Level: peak_level → sustain_level × peak_level Sustain: Sound maintains constant level Time: attack_time + decay_time → attack_time + decay_time + sustain_time Level: sustain_level × peak_level (constant) Release: Sound fades to silence Time: attack_time + decay_time + sustain_time → total_time Level: sustain_level × peak_level → 0 Mathematical implementation: Uses piecewise functions with curve control Curve parameter shapes each segment Negative curves: convex (slow start, fast end) Positive curves: concave (fast start, slow end) Total duration: total_time = attack_time + decay_time + sustain_time + release_time If total_time > sound_duration, envelope is truncated

Why ADSR Matters

Perceptual advantages:

Complete Processing Pipeline

SETUP: Select Sound object Extract duration and sampling frequency Present envelope type selection dialog PARAMETER COLLECTION: IF Linear/Exponential/Sine/Welch: Get start_level and end_level IF Step: Get step_time, level_before, level_after IF Linen: Get attack_time, sustain_time, release_time, peak_level, curve_type IF Perc: Get attack_time, release_time, peak_level, curve IF ADSR: Get attack_time, decay_time, sustain_level, sustain_time, release_time, peak_level, curve ENVELOPE GENERATION: Build mathematical formula string for visualization Create Sound object for envelope display (1000 Hz) Create IntensityTier with 200 control points for smooth application FOR each control point: Calculate time position Compute envelope value using appropriate formula Convert to dB for IntensityTier Add point to IntensityTier APPLICATION: Multiply original sound by IntensityTier Rename result: "originalname_enveloped" VISUALIZATION: Erase Picture window Three-panel display: Top: Original sound waveform Middle: Envelope shape (as Sound) Bottom: Result waveform Add labels and axis markings FINALIZATION: Clean up temporary objects Select result object Display completion message Play result OUTPUT: Amplitude-shaped sound with comprehensive visualization

Envelope Types

Basic Envelopes

📈 Simple Amplitude Shapes

Character: Fundamental mathematical curves for basic amplitude control

Parameters: Start level, end level

Best for: Basic fades, simple amplitude shaping

Basic envelope types:

EnvelopeMathematical ShapeSonic CharacterTypical Use
LinearStraight lineNeutral, constant rateTechnical fades, equal change
ExponentialExponential curveNatural, logarithmicMusical fades, natural sounds
SineRaised cosineSmooth, musicalPhrase shaping, smooth transitions
WelchParabolic segmentsVery smooth, professionalBroadcast, film audio
StepInstant changeDramatic, abruptSpecial effects, instant changes

Advanced Envelopes

🎛️ Complex Amplitude Articulation

Character: Multi-segment envelopes for sophisticated shaping

Parameters: Multiple timing and level controls

Best for: Instrument-like articulation, complex dynamics

Advanced envelope types:

EnvelopeSegmentsSonic CharacterTypical Use
LinenAttack-Sustain-ReleaseSimplified articulationQuick shaping, basic instruments
PercAttack-Release onlyPercussive, impact soundsDrums, hits, percussive elements
ADSRAttack-Decay-Sustain-ReleaseFull articulation, expressiveComplex shaping, instrument simulation

Envelope Selection Guide

🎯 Choosing the Right Envelope

For simple fades: Linear, Exponential, or Sine

For smooth transitions: Welch or Sine

For dramatic effects: Step

For quick articulation: Linen or Perc

For complex shaping: ADSR

Parameters

Basic Envelope Parameters

ParameterTypeDefaultDescription
Start_levelreal0.1Amplitude at start (0-1 typically)
End_levelreal1.0Amplitude at end (0-1 typically)

Step Envelope Parameters

ParameterTypeDefaultDescription
Step_timerealduration/2Time when level change occurs
Level_beforereal0.1Amplitude before step time
Level_afterreal1.0Amplitude after step time

Linen Envelope Parameters

ParameterTypeDefaultDescription
Attack_timereal0.1Time to reach peak level
Sustain_timerealduration-0.3Time at peak level
Release_timereal0.2Time to fade from peak to zero
Peak_levelreal1.0Maximum amplitude level
CurveoptionlinearSegment shaping: linear/exponential/sine

Percussive Envelope Parameters

ParameterTypeDefaultDescription
Attack_timereal0.01Very fast attack time
Release_timereal0.5Release/decay time
Peak_levelreal1.0Maximum amplitude
Curvereal-4Curvature control (negative=convex)

ADSR Envelope Parameters

ParameterTypeDefaultDescription
Attack_timereal0.02Time from silence to peak
Decay_timereal0.2Time from peak to sustain
Sustain_levelreal0.7Level during sustain (0-1)
Sustain_timerealduration-0.5Duration of sustain phase
Release_timereal0.28Time from sustain to silence
Peak_levelreal1.0Maximum amplitude at peak
Curvereal-4Curvature for all segments

Applications

Audio Production

Use case: Professional fades and dynamic control

Technique: Use Exponential or Welch envelopes for natural fades

Example: Exponential fade-out for musical endings

Sound Design

Use case: Creating articulated amplitude shapes

Technique: Use ADSR for instrument-like articulation

Workflow:

Music Composition

Use case: Phrase shaping and dynamic expression

Advantages:

Example: Apply crescendo with Sine envelope for smooth build

Film and Broadcast

Use case: Professional-level automation and transitions

Technique: Use Welch envelopes for ultra-smooth transitions

Application: Dialogue leveling, music bed transitions

Practical Workflow Examples

🎵 Musical Fade Out

Goal: Create natural-sounding musical fade

Settings:

  • Envelope: Exponential
  • Start_level: 1.0
  • End_level: 0.001 (near silence)
  • Duration: Last 5 seconds of piece

Result: Natural, musical fade that doesn't call attention to itself

🥁 Percussive Hit

Goal: Shape drum sample for impact and clarity

Settings:

  • Envelope: Perc
  • Attack_time: 0.001 (instant attack)
  • Release_time: 0.3 (medium decay)
  • Peak_level: 1.0
  • Curve: -2 (slightly convex decay)

Result: Punchy drum hit with controlled decay

🎻 String Instrument Simulation

Goal: Create expressive amplitude contour for sustained sound

Settings:

  • Envelope: ADSR
  • Attack_time: 0.1 (moderate attack)
  • Decay_time: 0.15 (quick decay to sustain)
  • Sustain_level: 0.8 (strong sustain)
  • Sustain_time: 2.0 (long sustain)
  • Release_time: 0.5 (moderate release)
  • Peak_level: 1.0
  • Curve: -3 (slightly convex curves)

Result: Expressive, instrument-like amplitude envelope

Advanced Techniques

Creative envelope strategies:
  • Layered envelopes: Apply different envelopes to frequency bands
  • Envelope sequencing: Apply multiple different envelopes in sequence
  • Dynamic control: Use envelope to control other parameters (filter, pitch)
  • Reverse envelopes: Apply envelope backwards for special effects
  • Envelope modulation: Use one envelope to modulate another's parameters

Combine with other Praat tools for complex processing chains

Parameter optimization guide:
  • Linear: Use when constant rate of change is desired
  • Exponential: Use for natural-sounding fades (start_level > end_level)
  • Sine: Use for musical phrases and smooth transitions
  • Welch: Use for professional broadcast quality
  • Step: Use for dramatic changes and gating effects
  • Linen: Use for quick instrument-like shaping
  • Perc: Use for percussive sounds and impacts
  • ADSR: Use for complex, expressive articulation

Troubleshooting Common Issues

Problem: Click or pop at envelope boundaries
Cause: Discontinuous envelope changes, especially with Step type
Solution: Use smoother envelope types, ensure changes at zero-crossings
Problem: Envelope doesn't complete within sound duration
Cause: Timing parameters exceed sound length
Solution: Adjust timing parameters to fit within duration
Problem: Result too quiet or too loud
Cause: Level parameters set too low or high
Solution: Adjust level parameters, use visualization to check
Problem: Visualization doesn't match expectations
Cause: Parameter misunderstanding or mathematical mismatch
Solution: Check formulas, use simpler envelopes first to build intuition

Mathematical Deep Dive

Envelope Mathematics

Curve Parameter Implementation

Generalized curve shaping:

For negative curves (convex): envelope(t) = level × (progress)^(-1/curve) Where progress = t/duration for attack progress = 1 - (t/duration) for release Example: curve = -4 envelope(t) = level × (progress)^(1/4) Creates slow start, fast end (convex) For positive curves (concave): envelope(t) = level × [1 - (1 - progress)^(curve + 1)] Example: curve = 3 envelope(t) = level × [1 - (1 - progress)^4] Creates fast start, slow end (concave) Special cases: curve = -1: Linear envelope curve → -∞: Instant change curve → +∞: Delayed then instant change Perceptual mapping: Negative curves feel more "natural" for attacks Positive curves feel more "aggressive" for attacks Choice depends on desired perceptual character

Continuity Analysis

Mathematical smoothness:

C⁰ continuity (position): All envelope types except Step are C⁰ continuous No sudden jumps in amplitude value Prevents clicks and pops C¹ continuity (velocity): Sine and Welch envelopes are C¹ continuous Smooth first derivative (no sudden slope changes) Creates perceptually smooth transitions C² continuity (acceleration): Welch envelope approaches C² continuity Very smooth acceleration changes Professional broadcast quality Step envelope discontinuity: Infinite derivative at step time Can cause spectral splatter (clicks) Use only when dramatic effect desired Or ensure step occurs at zero-crossing Practical implications: C¹ continuous envelopes sound smoothest Visualize to ensure smoothness matches needs Choose envelope type based on required smoothness