LUFS Tool — User Guide

Loudness analysis and normalization tool with True Peak measurement, platform-specific targets, and intelligent gain limiting.

Standard: ITU-R BS.1770-4 (Loudness Units relative to Full Scale) Features: True Peak measurement, platform presets, safe gain limiting Output: Analysis or processed audio
Contents:

What this does

This script performs loudness analysis and normalization using the LUFS (Loudness Units relative to Full Scale) standard. It measures the perceived loudness of audio, compares it to target levels for different platforms (streaming, broadcast, etc.), and optionally applies gain adjustments to match those targets while preventing clipping.

Key Features:

Why LUFS matters: Traditional peak normalization (normalizing to 0 dBFS) doesn't account for perceived loudness. Two tracks with the same peak level can sound dramatically different in volume. LUFS solves this by:
  1. Frequency weighting: Emphasizes frequencies humans are most sensitive to (similar to Fletcher-Munson curves)
  2. Gating: Ignores very quiet sections that don't contribute to perceived loudness
  3. Integrated measurement: Averages loudness over entire program duration
  4. True Peak awareness: Accounts for intersample peaks that can cause clipping after encoding

Result: Consistent perceived volume across different tracks, genres, and playback systems.

Technical Implementation: (1) True Peak measurement: 4× oversampling (resample to 4× original rate) to detect intersample peaks. (2) LUFS estimation: Simplified calculation using RMS with -3 dB offset (approximation of ITU-R BS.1770). (3) Headroom calculation: Maximum safe gain = -1 dBTP - current True Peak. (4) Target comparison: Calculates gain needed for each platform target. (5) Intelligent warnings: Classifies issues into "Warning", "Caution", or "Achievable" categories. (6) Processing options: Three distinct modes with different clipping behaviors. (7) Safety measures: Limits processed audio to -1 dBTP for codec safety.

Quick start

  1. In Praat, select exactly one Sound object (mono or stereo).
  2. Run script…lufs_tool.praat.
  3. Choose Target Platform:
    • Custom (set your own target)
    • Streaming (Spotify/Apple: -14 LUFS)
    • YouTube (-13 LUFS)
    • Broadcast TV (-23 LUFS)
    • Cinematic (-27 LUFS)
  4. If choosing Custom, set custom_target_lufs (e.g., -16.0).
  5. Choose Processing Mode:
    • Analyze Only (measurement only, no processing)
    • Apply Exact Gain Needed (may cause clipping)
    • Apply Safe Gain Only (no clipping, may not reach target)
  6. Click OK — analysis runs, results displayed in Info window.
  7. Review the analysis and recommendations in the Info window.
  8. If processing was applied, output named "originalname_mastered" or "originalname_normalized".
Quick tip: Start with Analyze Only mode to understand your audio's characteristics. Check the True Peak measurement — if it's close to 0 dBFS (e.g., -0.5 dBTP), you have little headroom for gain. For streaming music: Use Streaming (-14 LUFS) target. For podcast/voice: YouTube (-13 LUFS) or custom -16 LUFS. Always read the recommendations in the Info window — they tell you if compression is needed first. The Safe Gain mode is conservative and won't cause clipping but may not reach your target — that's when you know you need dynamics processing first.
Important limitations: This script uses a simplified LUFS estimation (RMS-based approximation) rather than full ITU-R BS.1770-4 implementation. For professional mastering, use dedicated LUFS meters (like Youlean, iZotope Insight, etc.). The True Peak measurement is accurate (4× oversampling). The Exact Gain mode will apply the calculated gain even if it causes clipping — the script warns you but doesn't prevent it. Always check the output for distortion. Safe Gain mode limits to -1 dBTP to prevent codec clipping, but different codecs have different headroom requirements. For critical applications, leave more headroom (-2 to -3 dBTP).

Understanding LUFS

What are LUFS?

📊 Loudness Units relative to Full Scale

Definition: LUFS are a standardized measurement of perceived loudness, defined in ITU-R BS.1770-4.

Key concepts: - 1 LU (Loudness Unit) = 1 dB - 0 LUFS = reference level (not 0 dBFS!) - Negative values: typical for digital audio -20 LUFS = 20 dB below reference Relationship to dBFS: LUFS measures PERCEIVED loudness dBFS measures PEAK amplitude Same LUFS → similar perceived volume Same dBFS → may sound very different

Why not just use RMS or peak?

  • RMS: Measures energy but not perception (flat frequency weighting)
  • Peak: Measures maximum amplitude only
  • LUFS: Frequency-weighted, gated, integrated = matches human hearing

True Peak vs. Sample Peak

The intersample peak problem: Digital audio samples don't capture continuous waveforms. When reconstructed (especially by lossy codecs), peaks can occur between samples.
Example:
Sample values: [0.5, 0.8, 0.5] (no sample exceeds 0.8)
Reconstructed waveform between samples 2-3 might reach 0.9
This is an intersample peak (not captured in samples)
Codecs can clip these reconstructed peaks

Solution: True Peak measurement
Oversample 4× (interpolate between samples)
Detect maximum of reconstructed waveform
Report as dBTP (dB True Peak)

Script implementation:

# 4× oversampling oversampled = Resample: sampleRate × 4, 50 # Find maximum of oversampled signal max_val = Get maximum: 0, 0, "None" min_val = Get minimum: 0, 0, "None" peak = max(abs(max_val), abs(min_val)) true_peak_db = 20 × log10(peak)

LUFS Estimation Method

Important: This script uses a simplified LUFS approximation, not full ITU-R BS.1770-4 compliance.
Simplified calculation: rms = Get root-mean-square: 0, 0 estimated_lufs = 20 × log10(rms) - 3.0 Why -3.0 dB offset? - Approximates K-weighting filter - Roughly aligns RMS with LUFS for typical program material - Not accurate for all content types Limitations: - No frequency weighting (K-filter) - No gating (quiet passages affect measurement) - No integration window - ~±2 dB error compared to professional meters Use for: Quick assessment, relative comparisons Not for: Certification, broadcast compliance

For accurate LUFS: Use dedicated meter plugins (Youlean Loudness Meter, iZotope Insight, Waves WLM, etc.)

Headroom and Gain Calculations

Key calculations: 1. Current LUFS (estimated): L_current = 20×log10(RMS) - 3.0 2. Gain needed for target: gain_needed = target_LUFS - L_current (positive = needs boost, negative = needs reduction) 3. Current True Peak: TP_current = 20×log10(true_peak_amplitude) 4. Maximum safe gain (no clipping): max_safe = -1.0 - TP_current (assuming -1 dBTP safety margin) 5. Gap analysis: if gain_needed > max_safe: clipping_gap = gain_needed - max_safe (amount of limiting/compression needed)

Platform Targets

Common LUFS Standards

PlatformTarget LUFSTrue Peak LimitNotes
Spotify-14-1 dBTPLoudness normalization on by default
Apple Music-16-1 dBTPSlightly quieter than Spotify
YouTube-13 to -14-1 dBTPVaries, -13 is safe target
Tidal-14-1 dBTPHi-Fi streaming
Amazon Music-13 to -14-2 dBTPSome variability
Broadcast TV (EBU R128)-23-1 dBTPEuropean broadcast standard
ATSC A/85 (US TV)-24-2 dBTPUS broadcast
Netflix-27-2 dBTPCinematic content
Podcasts-16 to -19-1 dBTPComfortable listening

Platform Presets in Script

🎯 Built-in Platform Targets

Preset 1: Custom User-defined target (custom_target_lufs) Use for: Special requirements, experimenting Preset 2: Streaming (Spotify/Apple: -14 LUFS) Target: -14.0 LUFS True Peak safety: -1 dBTP Use for: Music distribution to streaming platforms Preset 3: YouTube (-13 LUFS) Target: -13.0 LUFS True Peak safety: -1 dBTP Use for: YouTube videos, content creation Preset 4: Broadcast TV (-23 LUFS) Target: -23.0 LUFS True Peak safety: -1 dBTP Use for: Television, documentary, broadcast Preset 5: Cinematic (-27 LUFS) Target: -27.0 LUFS True Peak safety: -1 dBTP Use for: Film, dynamic content, Netflix-style

Note: These are targets, not necessarily what platforms will play back at. Most platforms apply loudness normalization, so hitting these targets ensures your audio won't be turned down (or up) excessively.

Platform-Specific Considerations

Streaming platforms (Spotify, Apple, etc.):
  • Normalization is usually ON by default — users can turn it off
  • Loudness penalty: If your track is louder than -14 LUFS, platform will turn it down
  • No loudness benefit: Making it louder than -14 LUFS doesn't make it sound louder after normalization
  • Dynamic range benefit: Quieter targets allow more dynamic range without penalty

YouTube:

  • Varies between -13 and -14 LUFS
  • Music videos often mastered louder (-10 to -12 LUFS)
  • Spoken content benefits from -16 to -18 LUFS for clarity
  • YouTube compression can exacerbate clipping — be conservative with True Peak

Broadcast:

  • Strict compliance: EBU R128 (-23 ±0.5 LU) and ±1.0 LUF short-term
  • Measurement: Must use compliant meters (not this script's approximation)
  • Gating: Quiet passages below -70 LUFS are excluded from measurement
  • True Peak: Typically -1 dBTP maximum

Cinematic/Film:

  • Very dynamic: -27 LUFS allows huge peaks (explosions, quiet dialogue)
  • Theatrical vs. streaming: Theaters have more dynamic range than home systems
  • Netflix: Strict specs (-27 ±2 LU, -2 dBTP max, dialog gating at -24 LUFS)

Measurement Analysis

What the Analysis Measures

📈 Three Critical Measurements

MeasurementMethodPurposeAccuracy
True Peak4× oversampling, max detectionPrevent clipping in codecsHigh (±0.1 dB)
Estimated LUFSRMS with -3 dB offsetPerceived loudness approximationModerate (±2 dB)
RMSRoot mean square of samplesEnergy measurementHigh

Gap Analysis Categories

Category 1: TARGET IS ACHIEVABLE ✓ Condition: gain_needed ≤ max_safe Message: "Clean gain boost will work perfectly!" Meaning: Enough headroom exists to reach target without clipping Action: Use either Exact or Safe gain mode Category 2: SLIGHT LIMITING REQUIRED ⚠️ Condition: max_safe < gain_needed ≤ max_safe + 10 dB Message: "Slight limiting required (X.X dB)" Meaning: Small amount of clipping/limiting needed Action: Acceptable for many applications, or use Safe mode Category 3: SEVERE CLIPPING WARNING ⚠️⚠️⚠️ Condition: gain_needed > max_safe + 10 dB Message: "You need X.X dB of gain but only have Y.Y dB of headroom" Meaning: Major compression/limiting needed before normalization Action: Use compression first, or choose Safe mode

Interpretation Examples

Example 1: Well-mastered music True Peak: -3.2 dBTP Estimated LUFS: -18.5 LUFS Target: -14 LUFS (Streaming) Calculations: gain_needed = -14 - (-18.5) = +4.5 dB max_safe = -1.0 - (-3.2) = +2.2 dB gap = 4.5 - 2.2 = 2.3 dB Result: "Slight limiting required (2.3 dB)" Example 2: Dynamic classical recording True Peak: -0.5 dBTP Estimated LUFS: -27.0 LUFS Target: -14 LUFS (Streaming) Calculations: gain_needed = -14 - (-27) = +13.0 dB max_safe = -1.0 - (-0.5) = -0.5 dB gap = 13.0 - (-0.5) = 13.5 dB Result: "SEVERE CLIPPING WARNING"

Recommendations System

Intelligent suggestions based on analysis:

When gain_needed > max_safe + 10 dB:

"RECOMMENDATIONS: • Use compression in a DAW first • Choose 'Apply Safe Gain Only' for clean boost • Or lower your target"

When gain_needed > max_safe:

"RECOMMENDATIONS: • Accept slight limiting if aesthetic permits • Or use 'Safe Gain Only' mode • Consider gentle compression first"

When gain_needed ≤ max_safe:

"RECOMMENDATIONS: • Any processing mode will work • 'Exact Gain' achieves target perfectly • 'Safe Gain' leaves headroom"

Processing Modes

Mode 1: Analyze Only

📊 Measurement Without Processing

Purpose: Assess audio characteristics without altering the file

Operations: 1. Measure True Peak (4× oversampling) 2. Estimate LUFS (RMS approximation) 3. Calculate gain needed for each target 4. Calculate maximum safe gain 5. Display analysis and recommendations 6. No audio processing applied Output: - Detailed analysis in Info window - Original sound remains unchanged - No new sound objects created

Use when: Checking loudness before processing, comparing multiple files, educational purposes, initial assessment.

Mode 2: Apply Exact Gain Needed

⚡ May Cause Clipping

Purpose: Apply exactly the calculated gain to reach target, regardless of clipping

Operations: 1. Copy original sound 2. Apply gain: amplitude × 10^(gain_needed/20) 3. Check resulting peak 4. Classify outcome: - peak > 1.0: "CLIPPING!" warning - peak > 0.95: "Peak very close to 0 dBFS" - peak ≤ 0.95: "Peak is safe" 5. Rename with appropriate suffix Output naming: _CLIPPED — if peak > 1.0 _mastered — if peak ≤ 1.0

Warnings generated:

if final_peak > 1.0: "❌ AUDIO IS CLIPPING!" "Peak exceeded 0 dBFS by X.XX dB" "This audio is distorted." "To fix: Use compression before normalizing" if final_peak > 0.95: "⚠️ Peak very close to 0 dBFS" "May clip in some codecs"

Use when: You want to hit target exactly and will handle clipping separately, or when you know clipping is acceptable for your application.

Mode 3: Apply Safe Gain Only

🛡️ No Clipping Guaranteed

Purpose: Apply maximum gain that won't cause clipping, even if target isn't reached

Operations: 1. Copy original sound 2. Apply safe gain: amplitude × 10^(max_safe/20) 3. If max_safe ≤ 0.1 dB: skip (already at peak) 4. Scale peak to -1 dBTP for safety margin 5. Calculate resulting LUFS 6. Compare to target Output: _normalized — always this suffix Result LUFS = original_LUFS + max_safe Messages: if result_lufs < target_LUFS - 1: "Still X.X LU below target." "This is the maximum without distortion." "To reach Y.Y LUFS, use compression first." else: "✓ Target achieved!"

Safety margin: Limits to -1 dBTP (True Peak) to prevent clipping in codecs. Some codecs require more headroom (-2 to -3 dBTP).

Use when: Broadcast-safe processing, streaming distribution, podcasts, or any situation where clipping is unacceptable.

Mode Comparison

AspectAnalyze OnlyExact GainSafe Gain
Audio modified?NoYesYes
Can cause clipping?N/AYesNo
Reaches target?N/AAlwaysOnly if safe
Output suffixN/A_mastered or _CLIPPED_normalized
True Peak limitN/ANone-1 dBTP
Best forAssessmentExact matchingSafe distribution

Parameters

Target Platform Selection

ParameterTypeOptionsDefaultDescription
target_platformoptionMenuCustom, Streaming, YouTube, Broadcast TV, CinematicCustomSelect target loudness platform
custom_target_lufsreal-60.0 to 0.0-14.0Custom target (only used if platform=Custom)

Processing Mode Selection

ParameterTypeOptionsDefaultDescription
processing_modeoptionMenuAnalyze Only, Apply Exact Gain Needed, Apply Safe Gain OnlyAnalyze OnlySelect processing behavior

Derived Parameters (Calculated)

ParameterCalculationTypical RangeDescription
target_LUFSBased on platform selection-27 to -13Final target loudness
estimated_lufs20×log10(RMS)-3.0-50 to -5Estimated current loudness
true_peak_db20×log10(4×oversampled peak)-60 to 0True Peak measurement
gain_neededtarget_LUFS - estimated_lufs-30 to +30 dBGain required to reach target
max_safe-1.0 - true_peak_db-59 to +1 dBMaximum gain without clipping

Professional Workflow

Complete Loudness Management Process

1. PRE-PROCESSING ASSESSMENT Run script in "Analyze Only" mode Note: True Peak, Estimated LUFS, gain_needed, max_safe 2. DECISION POINT if gain_needed ≤ max_safe: → Proceed to step 4 (no compression needed) else: → Proceed to step 3 (compression needed) 3. DYNAMICS PROCESSING (if needed) Apply compression/limiting in DAW or with other tools Goal: Reduce peak-to-LUFS ratio Re-assess after processing (back to step 1) 4. LOUDNESS NORMALIZATION Choose processing mode based on needs: - Safe distribution: "Apply Safe Gain Only" - Exact matching: "Apply Exact Gain Needed" (with caution) 5. POST-PROCESSING VERIFICATION Check True Peak ≤ -1 dBTP (or stricter for your platform) Listen for distortion/clipping Test on multiple playback systems 6. PLATFORM-SPECIFIC ADJUSTMENTS Adjust based on platform requirements: - Streaming: -14 LUFS ±1, -1 dBTP - Broadcast: -23 LUFS ±0.5, -1 dBTP - Cinematic: -27 LUFS ±2, -2 dBTP

Practical Examples

🎵 Music Mastering for Streaming

Scenario: Finished mix needs to hit streaming targets

Workflow:

  1. Analyze: Shows -18.5 LUFS, -3.2 dBTP
  2. Calculation: Needs +4.5 dB, has +2.2 dB safe
  3. Action: Apply gentle compression (2-3 dB gain reduction)
  4. Re-analyze: Now -16.0 LUFS, -2.0 dBTP
  5. Calculation: Needs +2.0 dB, has +1.0 dB safe
  6. Final: Use "Safe Gain" mode, reaches -15.0 LUFS (close enough)

🎤 Podcast Episode

Scenario: Recorded podcast needs consistent loudness

Workflow:

  1. Analyze: Shows -22.5 LUFS, -6.8 dBTP
  2. Calculation: Needs +8.5 dB for -14 LUFS (streaming), has +5.8 dB safe
  3. Better target: Use custom -16 LUFS (more natural for speech)
  4. Recalculate: Needs +6.5 dB, has +5.8 dB safe
  5. Action: Light compression (1-2 dB) or accept slight limiting
  6. Final: Use "Safe Gain" mode, reaches -16.7 LUFS

🎬 Film Dialogue Normalization

Scenario: Dialogue track for film mixing

Workflow:

  1. Analyze: Shows -30.5 LUFS, -1.2 dBTP
  2. Target: Cinematic (-27 LUFS) or Broadcast (-23 LUFS)
  3. Choice: Use Broadcast (-23 LUFS) for TV version
  4. Calculation: Needs +7.5 dB, has -0.2 dB safe (problem!)
  5. Action: Significant compression/limiting needed first
  6. Process dynamics, then normalize with "Safe Gain"

Troubleshooting Common Issues

Problem: Analysis shows very low LUFS (-30 or lower)
Causes: Very dynamic recording, classical music, film dialogue
Solutions: Use appropriate target (Cinematic -27), or apply compression first
Problem: True Peak very close to 0 dBFS (-0.5 or higher)
Causes: Already limited/mastered material, brickwall limiting
Solutions: Little to no gain possible, may need to reduce target or accept current level
Problem: "Exact Gain" mode creates severe clipping
Causes: Large gap between gain_needed and max_safe
Solutions: Use compression first, or switch to "Safe Gain" mode
Problem: Different meters show different LUFS values
Causes: This script uses approximation; professional meters use full ITU-R BS.1770
Solutions: Use this for relative measurements, use professional meters for final compliance
Problem: Audio distorts after processing even with "Safe Gain"
Causes: Intersample peaks not fully caught, codec-specific clipping
Solutions: Use more conservative True Peak limit (-2 to -3 dBTP), test on target platform

Advanced Techniques

Multi-stage loudness management:
  1. Track level: Balance individual tracks in mix
  2. Mix bus: Gentle compression/limiting on master
  3. Analysis: Measure with this script
  4. Targeted processing: Apply needed compression based on gap analysis
  5. Normalization: Apply final gain adjustment
  6. Verification: Check on multiple meters and playback systems
Platform-specific strategies:
  • Streaming: Target -14 LUFS, but consider -16 LUFS for more dynamic range
  • Broadcast: Strict compliance needed, use professional meters for final
  • Podcasts: -16 to -19 LUFS often sounds more natural than -14
  • Film: Different standards for theatrical (-27), broadcast (-23), streaming (-27)
  • Archival: Preserve dynamics, use conservative targets (-20 to -24 LUFS)

Best Practices

Professional recommendations:
  • Always analyze first: Never apply gain blindly
  • Mind the True Peak: -1 dBTP minimum, -2 dBTP safer for lossy codecs
  • Use appropriate targets: Not everything needs to be -14 LUFS
  • Preserve dynamics when possible: Quieter targets allow more expression
  • Test on target systems: Listen on phones, laptops, car systems
  • Use reference tracks: Compare loudness and dynamics to similar professional material
  • Document your process: Note settings for consistency across projects
  • When in doubt, be conservative: It's easier to make something louder later than to fix clipping