Skip to content

Environment Variables Reference

Phantom reads its runtime configuration from environment variables. The full set is 40 PHANTOM_* variables — paths and limits, analysis thresholds, FFT/frame sizes, and behavior flags — and phantom doctor prints the complete list with the value each has in your environment (or that it is unset).

Setting a variable takes effect on the next analysis; settings resolve per call, so there is no restart. The analysis cache keys on your settings, so a tuned run is never served a result computed under different settings.

Paths and Limits

VariableDefaultDescription
PHANTOM_AUDIO_DIR(none)Restrict input file reads to this directory tree. When unset, inputs may be read from anywhere (Phantom’s core use case); writes are always confined regardless.
PHANTOM_OUTPUT_DIR~/.phantom/outputDirectory all file writes are confined to. Writes outside it are rejected. Created on demand when unset; set this to write elsewhere.
PHANTOM_PROFILES_DIR(built-ins)Custom reference profile directory (overrides built-ins).
PHANTOM_METRICS_DIR(platform default)Directory for live metrics snapshots: ~/Library/PhantomStudio/metrics (macOS), %APPDATA%\PhantomStudio\metrics (Windows), ~/.config/PhantomStudio/metrics (Linux).
PHANTOM_MAX_DURATION900 (15 min)Maximum audio duration in seconds
PHANTOM_MAX_FILE_SIZE500000000 (500 MB)Maximum file size in bytes
PHANTOM_MAX_DECODED_BYTES1000000000 (1 GB)Maximum decoded float32 footprint per audio file in bytes
PHANTOM_MAX_AGGREGATE_BYTES4000000000 (4 GB)Combined decoded-size cap for multi-file tools

Analysis Thresholds

VariableDefaultDescription
PHANTOM_POLARITY_THRESHOLD-0.5Overall L/R correlation below this flags polarity inversion
PHANTOM_PHAT_WINDOW_S10.0GCC-PHAT cross-correlation window in seconds
PHANTOM_CREST_FACTOR_LOW_DB6.0Crest factor below this marks the track as over-compressed
PHANTOM_CLIPPING_THRESHOLD1.0Sample magnitude at or above this counts as clipping
PHANTOM_DC_OFFSET_THRESHOLD0.0005Mean sample value above this flags DC offset
PHANTOM_ISP_OVERSHOOT_DB0.5True-peak overshoot above this flags inter-sample peaks
PHANTOM_ISP_SEVERE_DBTP-1.0True peak above this raises ISP severity to significant
PHANTOM_DYNAMIC_SPREAD_MIN_DB10.0Minimum P90-P10 block spread to trust a noise-floor estimate
PHANTOM_NOISE_FLOOR_MODERATE_DB-50.0Noise floor above this is flagged moderate
PHANTOM_NOISE_FLOOR_MINOR_DB-60.0Noise floor above this is flagged minor
PHANTOM_SNR_PROFESSIONAL_DB60.0SNR at or above this counts as professional
PHANTOM_SNR_POOR_DB50.0SNR below this is flagged poor/significant
PHANTOM_SPECTRAL_FLATNESS_MIN0.01Minimum flatness to run band-excess detectors
PHANTOM_BAND_EXCESS_THRESHOLD_DB6.0Band energy above expected level triggers detection
PHANTOM_RESONANCE_MEDIAN_FLOOR_DB-40.0Median spectral level floor for resonance detection
PHANTOM_RESONANCE_PROMINENCE_DB12Peak prominence threshold for resonance detection
PHANTOM_LOSSY_SHELF_DROP_DB20.0Shelf drop above this indicates a lossy codec
PHANTOM_MASKING_SEVERITY_HIGH0.6Overlap score at or above this is labeled high severity
PHANTOM_MASKING_SEVERITY_MODERATE0.3Overlap score at or above this is labeled moderate severity
PHANTOM_MASKING_SEVERITY_LOW0.1Overlap score at or above this is labeled low severity
PHANTOM_MASKING_FLOOR_DB40.0Bands more than this below the pair peak are zeroed before scoring

FFT / Frame Sizes

VariableDefaultDescription
PHANTOM_SPECTRAL_FRAME_SIZE2048Frame size of the main spectral analysis pass
PHANTOM_SPECTRAL_HOP_SIZE1024Hop size of the main spectral analysis pass
PHANTOM_OCTAVE_FRAME_SIZE4096Frame size of the octave-band energy pass (spectral + masking)
PHANTOM_OCTAVE_HOP_SIZE2048Hop size of the octave-band energy pass
PHANTOM_FLATNESS_FRAME_SIZE4096Frame size of the spectral-flatness gate (band-excess detectors)
PHANTOM_SPECTRUM_FRAME_SIZE8192Frame size of the shared power-spectrum pass (resonance, lossy-codec detection)

Changing frame sizes changes the analysis geometry, so results are not numerically comparable with the built-in genre profiles or reference-target comparisons, both of which are calibrated to the default frame sizes. See AnalysisSettings for the full comparability caveat.

Output and Behavior

VariableDefaultDescription
PHANTOM_MASKING_TOP_N(auto)Number of top masking pairs returned (scales with stem count when unset)
PHANTOM_PROFILE_MERGE(none)Merge a user profile over the built-in instead of replacing it
PHANTOM_PROFILE_OVERRIDE_QUIET(none)Silence the user-profile-override log line
PHANTOM_DEBUG(none)Enable verbose error output from MCP tools
PHANTOM_QUIET(none)Suppress startup preflight messages

Installer-only variables

PHANTOM_NO_TELEMETRY is not a runtime variable and doesn’t appear in phantom doctor. The installers (install.sh, install.ps1) honor it to opt out of install telemetry:

# macOS / Linux
curl -sSL https://fadelab.net/install | PHANTOM_NO_TELEMETRY=1 bash

The variable has to go on bash, not on curl. Writing PHANTOM_NO_TELEMETRY=1 curl ... | bash sets it for the download and not for the script that reads it, so telemetry still fires.

The Windows installer honors the same variable, but Phantom cannot be installed on Windows yet — see Getting Started for why and what’s being done about it.

Pro tip

The complete list above matches phantom doctor output exactly. If a variable isn’t listed here, the runtime doesn’t read it.