CLI Editing Commands
The per-command reference for the sonare commands that transform a take or generate a signal and write a WAV, plus the separation commands hpss and decompose-stems, which write one WAV per component, and split-silence, which only reports where a take is quiet. Analysis, feature and room commands are on CLI Commands; global options and exit codes are on the CLI Reference.
Editing
These transform audio and write a WAV to -o. Per-note editing and scale correction are walked through in CLI Examples.
| Command | Description | Options |
|---|---|---|
sonare pitch-correct vocal.wav --current-midi 68.7 --target-midi 69 -o out.wav | Pitch-correct toward a target MIDI note | --current-midi and --target-midi, both required |
sonare pitch-correct-timevarying vocal.wav -o out.wav | Track a pYIN contour and correct it to one note or a scale | --mode midi|scale (midi), --target-midi (69.0; 0 to 127), --scale-root (0; 0 to 11), --scale-mode-mask (2741; a mask from 1 to 4095 or a mode name such as minor), --reference-midi (69.0), --hop-length (512), --retune-amount (1.0; 0 to 1), --max-correction-semitones (12.0), --retune-speed-ms (50.0), --vibrato-threshold-cents (20.0) |
sonare note-move take.wav --onset-sample 0 --offset-sample 22050 --target-onset-sample 48000 -o out.wav | Move one note region to a new onset | --onset-sample or --onset-sec, --offset-sample or --offset-sec, --target-onset-sample or --target-onset-sec; each bound takes one spelling only, and all are 0 or above |
sonare note-stretch take.wav --onset-sec 0.5 --ratio 1.5 -o out.wav | Time-stretch a single note region | --onset-sample or --onset-sec, --offset-sample or --offset-sec (an omitted offset stretches to the end of the input), --ratio (1.0; above 0) |
sonare scale-quantize 68.7 | Quantize one MIDI value to a scale | --root (0; 0 to 11), --mode-mask (2741; a mask from 1 to 4095 or a mode name), --reference-midi (69.0; 0 to 127) |
sonare voice-change vocal.wav -o out.wav | Voice change (pitch + formant) | --pitch-semitones, --formant-factor, --formant-mode relative|absolute (relative); see Realtime voice presets |
sonare pitch-shift vocal.wav --pitch-semitones 3 -o out.wav | Transpose without changing length | --pitch-semitones (required), --n-fft (2048), --hop-length (n_fft/4) |
sonare time-stretch take.wav --rate 1.2 -o out.wav | Change length without changing pitch | --rate (required), --n-fft (2048), --hop-length (n_fft/4) |
sonare normalize mix.wav -o out.wav | Peak or RMS normalization | --mode peak|rms (peak), --target-db (0.0 for peak, -20.0 for rms) |
sonare trim-silence take.wav -o out.wav | Trim leading/trailing silence. By default it cuts below an absolute -60 dBFS, like the library's trim; --top-db switches to the peak-relative rule of trimSilence. Without -o it reports the result and writes nothing | --top-db, --threshold-db (-60.0), --n-fft (2048), --hop-length (512) |
sonare resample music.wav --target-sample-rate 44100 -o out.wav | Resample | --target-sample-rate (required; 8000 to 384000) |
sonare polyphonic-notes chord.wav | List the notes a polyphonic analysis found | — |
sonare vocal-notes vocal.wav | List the notes a vocal edit session finds in a monophonic take, with each note's pitch in cents from the nearest note | --segmentation-threshold-cents, --min-note-ms, --f0-min-hz, --f0-max-hz, --reference-hz, --frame-length-samples, --hop-length-samples (all above 0, no stated default: the library chooses), --yin-threshold (above 0, up to 1), --voiced-threshold (0 to 1), --no-centered |
sonare polyphonic-render chord.wav -o out.wav | Re-render that analysis with per-note edits | --edit NOTE.FIELD=VALUE (repeatable) |
sonare project align-takes --reference-source 1 -o aligned.json project.json | Align every take in a project to one reference source and write the project back with a warp map per take; reads the source files; a take recorded at another rate is resampled onto the reference's grid and the anchors are written at the project rate (see Recording and Takes) | --reference-source (required; 1 or above), --audio SOURCE_ID=WAV (repeatable), --resolve-audio, --hop-length (512), --bins-per-octave (12) |
--top-db and --threshold-db are mutually exclusive, alternate silence selectors: passing neither defaults --threshold-db to -60; passing --top-db switches to a top-dB-relative-to-peak selector instead.
Both CLIs provide every edit command above. hpss also requires -o and writes <base>_harmonic.wav and <base>_percussive.wav while printing its energy summary.
No inert defaults
--pitch-semitones on pitch-shift and --rate have no default, because any default would make the command a silent no-op. Leaving either out is a usage error (exit 2). The same rule holds for pitch-correct-timevarying --mode, which accepts only midi or scale; anything else is a usage error (exit 2) instead of a fallback.
Level, fade, filter and emphasis commands read a file and write a WAV to -o:
| Command | Required or notable option |
|---|---|
sonare gain music.wav -o out.wav --gain-db -6 | -o, --gain-db (required) |
sonare fade music.wav -o out.wav --fade-in-sec 0.5 --fade-out-sec 1 | -o, --fade-in-sec and/or --fade-out-sec (0 or above) |
sonare filter music.wav -o out.wav --type high-pass --cutoff-hz 80 | -o, --type high-pass|low-pass|band-pass|notch (required); --cutoff-hz for high-pass/low-pass, --center-hz + --bandwidth-hz for band-pass/notch (each above 0); --order (2), --zero-phase |
sonare preemphasis speech.wav -o out.wav, sonare deemphasis speech.wav -o out.wav | -o; --coef (0.97) |
filter --order takes 2 or 4, and 4 is accepted for high-pass/low-pass only — a fourth-order band-pass or notch is a usage error. --zero-phase runs the filter forwards and then backwards (filtfilt) so the result has no phase shift, at the cost of doubling the effective slope and of needing the whole file in hand.
Generators
tone, chirp and clicks take no input file and write a WAV to -o.
| Command | Options |
|---|---|
sonare tone --frequency-hz 440 -o tone.wav | --frequency-hz (required), --sample-rate (22050; 8000 to 384000), --duration-sec (1.0), --phase (0.0), --amplitude (1.0) |
sonare chirp --fmin-hz 100 --fmax-hz 8000 --exponential -o chirp.wav | --fmax-hz (required; above 0), --fmin-hz (0.0), --exponential (linear sweep when omitted), --sample-rate (22050; 8000 to 384000), --duration-sec (1.0) |
sonare clicks --times 0.5,1.0,1.5 -o clicks.wav | --times (required; comma-separated seconds), --sample-rate (22050; 8000 to 384000), --length (through the last click and its decay; 1 to 500000000 samples), --frequency-hz (1000.0), --click-duration-sec (0.1) |
split-silence
split-silence finds where a take is quiet without altering it: it prints the non-silent intervals as sample ranges, and only writes audio when you ask it to slice by those intervals. It takes one or more audio files, and both front-ends take the same options.
sonare split-silence take1.wav
sonare split-silence take1.wav --jsonOutput:
Non-silent intervals: 3
20992 - 45568
87040 - 111616
153088 - 177664JSON Output:
[{"start_sample": 20992, "end_sample": 45568}, {"start_sample": 87040, "end_sample": 111616}, {"start_sample": 153088, "end_sample": 177664}]With --report, the JSON becomes an object, {"intervals": [...], "report": {...}}.
| Option | Default | Description |
|---|---|---|
--top-db | 60.0 | Silence threshold below the peak, in dB |
--write-takes PREFIX | — | Write every take sliced at every interval |
--report | off | With --json, add a report object: silence_ceiling_db (the largest --top-db at which any silence still shows; with several takes, the least headroom among them), plus max_signal_intervals and min_signal_intervals (the interval counts of the most and least fragmented single take) |
--n-fft, --hop-length | 2048, 512 | Analysis framing |
With more than one audio file, a cut falls only where every take is quiet. The multi-take form, --write-takes and the errors are walked through under Splitting Takes at Silence.
-o/--output is a usage error (exit code 2): the command's result is the interval list or the sliced take files, never a single rendered output file.
Separation
hpss
Harmonic-Percussive Source Separation (HPSS, see Source Separation): splits a mix into its harmonic component (vocals, melody, sustained tones) and its percussive component (drums, transients).
sonare hpss music.mp3 -o separated
sonare hpss music.mp3 -o separated --json| Option | Default | Description |
|---|---|---|
--kernel-harmonic <int> | 31 | Harmonic median-filter kernel size |
--kernel-percussive <int> | 31 | Percussive median-filter kernel size |
--n-fft | 2048 | STFT window (above 0) |
--hop-length | n_fft/4 | STFT hop (above 0) |
--harmonic-only | off | Write only the harmonic component |
--percussive-only | off | Write only the percussive component |
--with-residual | off | Also separate and write a residual component |
--hard-mask | off | Use a hard mask instead of the default soft mask |
-o is required. --harmonic-only, --percussive-only, and --with-residual are mutually exclusive; combining them is a usage error (exit 2).
Output:
HPSS: 529200 samples
Harmonic energy: 0.070496
Percussive energy: 0.008950
Wrote: separated_harmonic.wav, separated_percussive.wavWith --json the levels are harmonic_mean_abs and percussive_mean_abs (plus residual_mean_abs with --with-residual), each the mean absolute sample value of that component, next to length, sample_rate and the written file names.
decompose-stems
Split a mix into non-negative matrix factorization (NMF) components (see Source Separation) — a data-driven separation that finds recurring spectral patterns instead of the fixed harmonic/percussive split hpss applies.
sonare decompose-stems band.wav -o stems.wav
sonare decompose-stems band.wav -o stems.wav --n-components 6 --init nndsvd --json| Option | Default | Description |
|---|---|---|
--n-components <int> | 4 | Number of components to factor the mix into (1 or above) |
--n-iter <int> | 100 | NMF update iterations (1 or above) |
--beta | 2.0 | Beta divergence: 2 is Frobenius, 1 is Kullback-Leibler |
--init | random | NMF initialization: random or nndsvd |
--mask-power | 1.0 | Soft-mask exponent (>= 1); 2 gives the Wiener-style power ratio |
--n-fft | 2048 | STFT window (1 or above) |
--hop-length | n_fft/4 | STFT hop (1 or above) |
-o is required and names the set rather than one file: both CLIs write <base>_component1.wav … <base>_componentN.wav, stripping a trailing .wav from the path you gave. Every component keeps the source's phase, so the components sum back to the input and each one is listenable on its own. That is the difference from the library's bare decompose, which returns the factors of a magnitude spectrogram and leaves you needing a phase estimator to hear anything.
Output:
Stems: 4 components
1. energy 0.021761 stems_component1.wav
2. energy 0.034607 stems_component2.wav
3. energy 0.008865 stems_component3.wav
4. energy 0.025433 stems_component4.wav
Wrote: stems_component1.wav, stems_component2.wav, stems_component3.wav, stems_component4.wavRealtime voice presets
These commands inspect, validate, or render the realtime voice-changer preset chain:
| Command | Description | Options |
|---|---|---|
sonare voice-change vocal.wav --preset brightIdol -o out.wav | Render through the realtime voice preset chain when --preset, --preset-json, --preset-pack, or --set is supplied | --preset (none), --preset-json, --preset-pack, --set PATH=VALUE (repeatable) |
sonare voice-presets | List realtime voice changer preset ids | --json |
sonare voice-preset | Print one preset's config as JSON | --preset (neutralMonitor), --json |
sonare voice-preset-validate preset.json | Validate and normalize a preset JSON file or preset pack | --preset-json FILE (takes precedence over the positional file), --preset when validating a pack, --set PATH=VALUE (repeatable), --json |
Without realtime preset options, voice-change uses the simple pitch/formant helper controlled by --pitch-semitones, --formant-factor and --formant-mode. With relative (the default) the formant factor is a warp in [0.55, 1.65] applied after the pitch shift, so the formants follow the pitch (a factor outside the range is refused); with absolute it is the formant shift relative to the input whatever the pitch shift (1.0 keeps the formants where they were), and a request the formant warp cannot reach is refused with the reachable range. --json reports the requested formant_factor on both CLIs. With preset options, it uses the realtime voice chain; combining preset options with any of the three simple controls is a usage error (exit 2).
Preset selection is explicit: choose a built-in --preset ID, a --preset-json FILE, or the pair --preset-pack FILE --preset ID. The pack file and entry ID form one selector; --preset-pack without --preset is rejected (there is no first-entry fallback). --preset-json cannot be combined with a pack, and --set PATH=VALUE requires a preset selector.
A preset the library refuses is a verdict for voice-preset-validate: it prints ok false and exits 3, where voice-change refuses the same document with exit 5.
tune-to-midi
tune-to-midi corrects a recorded take against the melody a Standard MIDI File carries. It tracks the take's pitch with pYIN at the library defaults, segments it into notes, gives each note the pitch shift of the reference note it overlaps longest, and renders the result. The rule that lines notes up with targets is the one noteTargetsFromSmf and assignNoteTargets follow; this command is that pair from a shell. It takes the take as its file argument.
sonare tune-to-midi take.wav --reference-smf melody.mid -o tuned.wav
sonare tune-to-midi take.wav --reference-smf song.mid --track 0 --unmatched-policy mute -o tuned.wav --json| Option | Default | Description |
|---|---|---|
--reference-smf FILE | required | The SMF carrying the reference melody |
--track N | 0 | Which MIDI-bearing track of the file is the melody; an index with no such track is refused by the library (exit 3) |
--unmatched-policy | leave | A note no target reaches: leave renders it as recorded, mute silences its span, nearest takes the target nearest in time, however far away |
--min-overlap-ratio | the library's default, 0.5 | Fraction of a note that must overlap a target for the target to count, 0 to 1 |
--max-correction-semitones | the library's default, 12 | Where the assigned shift saturates rather than being refused; 0 or more |
-o | required | The corrected WAV |
--json reports length, sample_rate, duration, assigned_count, note_count, and output. A missing --reference-smf or -o, an unknown --unmatched-policy, and a --min-overlap-ratio outside 0 to 1 are usage errors (exit 2). An assigned_count of zero is a result rather than an error: it means the reference did not line up with the take, which is worth checking before trusting the file.