Skip to content

CLI Mastering and Repair ​

Everything that writes a finished master or fixes a damaged take. Both CLIs carry every command below; the availability table has the full list. The options are listed per command below.

Which command for which task ​

I want to...Command
Reach a loudness target under a true-peak ceilingsonare mastering-normalize-loudness
Use a named presetsonare mastering --preset NAME
Let the assistant pick the chain from the audiosonare mastering --assistant, or mastering-suggest to see the chain first
Run my own chainsonare mastering --chain-config chain.json
Shape the tone with one equalizersonare eq
Fix clipping, clicks, hum or noisesonare repair, or sonare repair --stages declip for clipping alone
Run one named processorsonare mastering-processor
Compare a track with a referencesonare mastering-pair-analyze, mastering-pair-processor
Preview platform normalizationsonare mastering-streaming
Check the mono compatibility of a stereo pairsonare mastering-stereo-analyze (list the analyses with sonare mastering-stereo-analyses)
List the processors that take a referencesonare mastering-pair-processors

Examples ​

bash
# Loudness-normalize to a target with a true-peak ceiling, write a WAV
sonare mastering-normalize-loudness track.wav --target-lufs -14 --ceiling-dbtp -1 -o master.wav

# Inspect processors compiled into this libsonare build
sonare mastering-processors

# Run a named mastering processor and write a mastered WAV
sonare mastering-processor track.wav \
  --processor spectral.airBand \
  --params amount=0.4,shelfFrequencyHz=14000 \
  -o libsonare-master.wav

# Apply the unified equalizer: one high-shelf band (--type 2)
sonare eq track.wav --type 2 --frequency-hz 12000 --gain-db 2.5 --q 0.7 -o eq.wav

# Apply a named mastering preset
sonare mastering track.wav --preset pop -o mastered.wav

# Write the assistant's suggested chain, then run it
sonare mastering-suggest track.wav --config-out chain.json
sonare mastering track.wav --chain-config chain.json -o chained.wav

# List the available mastering preset names
sonare mastering-presets

# Repair clipped audio via LPC reconstruction
sonare repair clipped.wav --stages declip -o fixed.wav

# Reference-based loudness / tonal analysis
sonare mastering-pair-analyses
sonare mastering-pair-analyze track.wav \
  --reference reference.wav \
  --analysis match.referenceLoudness \
  --json > mastering-report.json

mastering-pair-analyze and mastering-pair-processor read the reference at its own sample rate and resample it onto the source's; equal rates are processed exactly as they would be without the step. mastering-stereo-analyze is the exception: the input is the left channel and --reference the right one, both must already be at the same rate, and a mismatch is an error (exit 3). Use the Python API when you need finer control over resampling or trimming before comparison.

The /mastering browser demo uses the same mastering processor families. Use the exported report from the demo as a starting point for CLI automation.

mastering ​

mastering runs a mastering chain on the file. Name the chain with exactly one of --preset, --chain-config or --assistant (which may take --preset as its base); with none of them the command is a usage error, and loudness-only normalization is mastering-normalize-loudness.

OptionDefaultDescription
--preset NAME—Start from a named preset (mastering-presets lists them)
--chain-config FILE—Run a complete chain document. Cannot be combined with --preset or --assistant
--params k=v,...—Overrides on top of the chosen preset, document or suggestion; needs one of the three
--bits16Output bit depth, 16 or 24
--assistantoffMaster with the chain the mastering assistant suggests; --preset names its base
--target-lufs-14With --assistant: integrated loudness target
--ceiling-dbtp-1With --assistant: true-peak ceiling in dBTP
--target-platformstreamingWith --assistant: streaming, youtube, broadcast, podcast, audiobook, cinema, club or cd
--enable-repairoffWith --assistant: let the suggestion enable measured repair stages
--no-streaming-safeoffWith --assistant: do not prefer the streaming-safe denoise estimator
--speech-mono-amount1With --assistant: how much the speech preset collapses side energy at low frequencies, 0 to 1
--explainoffWith --assistant: report why each stage was chosen
--report FILE—Write a mastering report JSON file. The native CLI writes through a temporary file and replaces the destination only on success, so a failed write leaves an existing report intact

The six assistant options (--target-lufs, --ceiling-dbtp, --target-platform, --enable-repair, --no-streaming-safe, --speech-mono-amount) and --explain are refused without --assistant; use --params to override a preset or document.

mastering-normalize-loudness ​

mastering-normalize-loudness normalizes loudness under a true-peak ceiling and applies no other processing.

OptionDefaultDescription
--target-lufs-14Integrated loudness target
--ceiling-dbtp-1True-peak ceiling in dBTP
--true-peak-oversample4Oversampling for the true-peak limiter: 1, 2, 4, 8 or 16
--bits16Output bit depth, 16 or 24
--report FILE—Write a mastering report JSON file

eq ​

eq applies the unified equalizer. One call sets one band from --type, --frequency-hz, --gain-db and --q; pass --params for several bands. --placement and --output-pan act on the file's own channels, and a two-channel file is processed as a pair. sonare eq --help lists the dynamic, sidechain and phase options. The all-pass band (--type 9) changes phase only; linear-phase mode refuses it by name.

--typeBand--typeBand
0peak5band-pass
1low shelf6notch
2high shelf7tilt shelf
3low-pass8flat tilt
4high-pass9all-pass

Assistant commands ​

The three assistant commands each take an audio file and print a JSON object to stdout. The result fields are described on Mastering Assistant.

CommandKey optionsOutput
sonare mastering-profile track.wav--params key=val,...Audio profile JSON (loudness, dynamics, spectral character)
sonare mastering-suggest track.wav--preset, --target-lufs, --ceiling-dbtp, --target-platform, --enable-repair, --no-streaming-safe, --speech-mono-amount (the same meanings as on mastering --assistant), --params key=val,..., --config-out FILESuggested mastering chain as JSON
sonare mastering-streaming track.wav--platforms '[...]', --platforms-file f.jsonPer-platform normalization preview as JSON

mastering-suggest --config-out chain.json also writes the suggested chain as a complete document (on the native CLI, through a temporary file that replaces the destination only on success). Edit it, then run it with sonare mastering track.wav --chain-config chain.json -o out.wav. A setting given both as an option and in --params is refused. --platforms accepts a JSON array of {name, target_lufs, ceiling_dbtp} objects. --params on mastering-profile takes comma-separated key=value float pairs for the underlying call.

An unknown key in mastering-suggest --params is a usage error (exit 2) before the audio is read. The accepted camelCase keys are listed in sorted order: ceilingDbtp, enableRepair, preferStreamingSafe, preset, speechMonoAmount, targetLufs, targetPlatform. For example, target_platform=club is unknown; use targetPlatform=club.

Preset and chain commands ​

mastering-presets lists the preset names a --preset option accepts, and honors the global --json flag.

A --chain-config document and --params form one parameter list, and a --params key the chain does not know is a usage error (exit 2).

Enum-valued parameters accept their choice name beside the number:

KeyAccepted names
repair.denoise.modelogMmse, mmseStsa, spectralSubtraction
repair.denoise.noiseEstimatormcra, imcra, spp
repair.dehum.modesubtract, notch
repair.decrackle.modemedian, waveletShrinkage

repair.decrackle.mode refuses any other number than 0 (median) or 1 (waveletShrinkage), and a partial name such as wavelet is refused with the valid names.

repair ​

repair fixes damaged takes. Without --stages or --preset it measures the take and runs the defect-repair stages it needs — declip, declick, decrackle, dehum, denoise, dereverb, in that order — so it is the command to reach for when you do not already know what is wrong with the recording. --stages runs exactly the stages you name, such as --stages declip for clipping alone.

bash
# Measure and report only; writes nothing
sonare repair noisy.wav --detect --json

# Measure, choose the stages, repair, and say why each was chosen
sonare repair noisy.wav -o clean.wav --explain

# Take the repair settings from a named preset instead of letting it choose
sonare repair noisy.wav --preset broadcast -o clean.wav
OptionDescription
--detectMeasure and report only. No processing runs and no file is written. Refused together with -o, --explain, --preset, --stages, --params and --bits
--preset NAMETake the repair stages from a named preset (sonare mastering-presets lists them) instead of the measure-and-choose path
--stages LISTRun exactly these stages, as a comma list of declip, declick, decrackle, dehum, denoise, dereverb, at the library's defaults. Cannot be combined with --preset or --explain; an unknown or repeated name is refused
--paramsStage overrides as repair.<stage>.<field>=value,...
--explainReport why each stage was chosen
--bitsOutput bit depth, 16 or 24

-o is required unless --detect is given. --explain only describes a decision that actually ran, so combining it with --preset, --stages or --detect is refused as a usage error (exit 2). A file too short for the detectors reports {"mode": "detect"} with no defects object.

repair runs no limiter on purpose, and declipping rebuilds the peaks a clipper cut off, so the result routinely exceeds full scale. The whole file is fitted with a single gain rather than clamped sample by sample — clamping would pin the very samples the repair had just rescued back onto the ceiling they came from. The gain applied is reported as output_gain_db, always present and 0 when the peak already fit.

Related mastering guides: Delivery targets, Meter reading, Error recovery.