GitHub
๐ŸŽ›๏ธ v1.0.1 โ€” Pure Rust MP3 Processing

Bake Auto Gain Into Your Files.
Before You Export.

Rekordbox Auto Gain doesn't work on CDJs. headroom simulates Auto Gain and permanently applies it to your filesโ€”so every track hits the same level on the booth.

The CDJ Auto Gain Problem

Rekordbox's Auto Gain feature analyzes your tracks and calculates gain adjustments to normalize loudness. It works great with controllers.

But when you export to USB for CDJs, Auto Gain values are ignored.

  • Quiet tracks from smaller labels need +3~4dB trim boost
  • Old releases and CD rips are often much quieter
  • Constant trim adjustments mid-set break your flow
  • Risk of clipping if you forget to reset trim
Current Workflow
Rekordbox analyzes track โ†’ Auto Gain: +2.5dB
โ†“
Export to USB
โ†“
CDJ ignores Auto Gain value โš ๏ธ
โ†“
Track plays too quiet โ†’ Manual trim adjustment

The Solution: Bake It In

headroom simulates what Rekordbox Auto Gain doesโ€”but instead of storing a metadata value, it permanently applies the gain to your audio files.

headroom Workflow
headroom analyzes track โ†’ Headroom: +2.5dB
โ†“
Gain baked into audio file โœ“
โ†“
Export to USB (Rekordbox metadata preserved)
โ†“
CDJ plays at correct level โœ“

Same Algorithm, Permanent Result

headroom uses the same approach as Rekordbox Auto Gain: it measures True Peak and calculates maximum safe gain without clipping.

  • Analyzes LUFS and True Peak (same as Rekordbox)
  • Pure Rust MP3 processingโ€”no external tools needed
  • Applies gain without limiting or compression
  • Preserves all Rekordbox metadata
Terminal โ€” v1.0.1 with native MP3 processing
$ headroom

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ headroom v1.0.1 โ”‚
โ”‚ Audio Loudness Analyzer & Gain โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

โœ“ Found 24 audio files
โœ“ Analyzed 24 files

โ— 3 lossless files (ffmpeg, precise gain)
Filename LUFS True Peak Target Gain
track01.flac -13.3 -3.2 dBTP -0.5 dBTP +2.7 dB

โ— 2 MP3 files (native lossless, 1.5dB steps, target: -2.0 dBTP)
Filename LUFS True Peak Target Gain
track04.mp3 -14.0 -5.5 dBTP -2.0 dBTP +3.0 dB

โ— 2 MP3 files (re-encode required for precise gain)
Filename LUFS True Peak Target Gain
track06.mp3 -12.0 -1.5 dBTP -0.5 dBTP +1.0 dB

? Apply lossless gain adjustment to 3 lossless + 2 MP3 files? [y/N] y

โ„น 2 MP3 files have headroom but require re-encoding for precise gain.
โ€ข Re-encoding causes minor quality loss (inaudible at 256kbps+)
โ€ข Original bitrate will be preserved
? Also process these MP3 files with re-encoding? [y/N] y

โœ“ Done! 7 files processed.
โ€ข 3 lossless files (ffmpeg)
โ€ข 2 MP3 files (native, lossless)
โ€ข 2 MP3 files (re-encoded)

Three-Tier MP3 Processing

headroom intelligently chooses the best method for each MP3 file based on available headroom, prioritizing quality preservation. v1.0.1 introduces pure Rust MP3 processingโ€”no external tools required.

Native Lossless Pure Rust

For files with โ‰ฅ1.5dB headroom to bitrate ceiling

  • Truly lossless global_gain modification
  • 1.5 dB step increments
  • No external dependencies
  • No re-encoding, no quality loss

Re-encode Opt-in

For files needing precise gain (<1.5dB headroom)

  • Arbitrary precision (e.g., +0.7dB)
  • Preserves original bitrate
  • Requires explicit confirmation
  • Inaudible loss at โ‰ฅ256kbps

Skip

For files already at optimal level

  • No headroom available
  • True Peak already at ceiling
  • File is not modified
  • Shown in analysis but skipped

๐Ÿ”ฌ Why Re-encoding is Safe at High Bitrates

A common concern is quality loss when re-encoding MP3. However, for gain adjustment only at high bitrates (โ‰ฅ256 kbps), the degradation is completely inaudible.

  • Quantization noise below -90dB โ€” far below audible threshold
  • ABX tests confirm โ€” listeners cannot distinguish 320kbpsโ†’320kbps re-encodes
  • Waveform preserved โ€” gain is simple multiplication, no compression or EQ applied
  • Club environment โ€” any theoretical difference is masked by ambient noise and PA characteristics
  • High-quality encoder โ€” headroom uses libmp3lame with -q:a 0 (best quality)

Built for Rekordbox DJs

Everything you need for consistent levels on CDJs.

๐Ÿฆ€

Pure Rust Implementation

v1.0.1 introduces native MP3 global_gain manipulation. No mp3gain dependencyโ€”just install headroom and ffmpeg.

๐ŸŽš๏ธ

Auto Gain Simulation

Uses the same LUFS/True Peak analysis as Rekordbox. Calculates maximum safe gain to hit optimal ceiling without clipping.

๐Ÿ’พ

Rekordbox Compatible

Files are modified in-place, preserving the same path. All your cue points, hot cues, beat grids, and tags remain intact.

๐Ÿ”’

Non-Destructive

Original files are backed up before processing. Native MP3 lossless is truly bit-perfect. Your source collection stays safe.

โœ…

Two-Stage Confirmation

First confirm lossless processing, then optionally enable MP3 re-encoding. You're always in control.

๐Ÿ“Š

Smart True Peak Ceiling

Based on AES TD1008: -0.5 dBTP for lossless, -2.0 dBTP for native MP3, bitrate-aware for re-encode.

Supported Formats

All the formats Rekordbox DJs actually use.

Format Method Precision Quality
FLAC ffmpeg volume filter Arbitrary Lossless
AIFF ffmpeg volume filter Arbitrary Lossless
WAV ffmpeg volume filter Arbitrary Lossless
MP3 Native (Pure Rust) 1.5dB steps Lossless
MP3 ffmpeg re-encode (opt-in) Arbitrary Inaudible at โ‰ฅ256kbps

Installation

Get up and running in seconds.

๐ŸŽ macOS (Homebrew)

brew tap M-Igashi/tap brew install headroom

ffmpeg is installed automatically. No other dependencies needed.

๐Ÿง Linux

sudo apt install ffmpeg cargo install --git https://github.com/M-Igashi/headroom

Requires Rust toolchain

๐ŸชŸ Windows

winget install ffmpeg cargo build --release

Build from source with Rust

Stop adjusting trim on the booth.

Run headroom before your next USB export and play with consistent levels.