CLI Commands
The per-command reference for the sonare CLI: what each command does, its options and defaults, and what it prints. Global options, exit codes, stereo handling and the list of which CLI carries which command are on the CLI Reference. Whole shell workflows are on CLI Examples. Editing, generators, silence splitting, hpss and stem separation, voice presets and tune-to-midi are on CLI Editing Commands, and the mastering and repair commands on CLI Mastering and Repair. The utility commands and the numeric helpers close this page.
Which command for which task
| I want to... | Command | Where |
|---|---|---|
| Get tempo, key and a full summary | analyze, bpm, key, beats | Analysis Commands |
| Find verses, choruses and other sections | sections, boundaries | sections, boundaries |
| Read the chord progression | chords | chords |
| Measure loudness | lufs, dynamics, meter | More analysis |
| Summarize spectral features | mel, chroma, spectral | Feature Commands |
| Track a melody or list a singer's notes | pitch, vocal-notes | pitch, Scale correction and vocal notes |
| Split a mix into parts | hpss, decompose-stems | hpss, decompose-stems |
| Turn audio into a MIDI file | transcribe | CLI Examples |
| Fix a damaged recording | repair | repair |
| Master a track for delivery | mastering, eq | Mastering and Repair |
| Change pitch, tempo or level of a file | pitch-shift, time-stretch, normalize, trim-silence | Editing |
| Generate a test tone, sweep or click track | tone, chirp, clicks | Generators |
| Cut a take at its silences | split-silence | split-silence |
| Estimate or simulate a room | acoustic, estimate-room, synthesize-rir, room-morph | Room commands |
| Mix stems into a scene | suggest-mix, mix, mix-strip | Mixing Workflow |
| Render a project or MIDI through the synth | project bounce, midi-render | Synthesis |
| Render movie audio to speakers or headphones | playback | Playback Renderer |
| Check a number or a conversion | power-to-db, frames-to-samples, ... | Numeric Helpers |
Analysis Commands
analyze
Full music analysis including BPM, key, time signature, and beats.
sonare analyze music.mp3
sonare analyze music.mp3 --json| Option | Default | Description |
|---|---|---|
--with-seventh | off | Search the full chord template set instead of triads only |
--hpss | off | Enable harmonic-percussive separation |
--chroma-high-pass-hz | 80.0 | High-pass cutoff for chroma analysis in Hz (0 or above) |
--meter-candidates | 3,4,6 | Comma-separated meter numerators to score |
--meter-denominator | 4 | Beat unit reported for the detected meter: a power of two in [1, 32] (another value is refused after the audio is read, exit 3) |
Without --with-seventh, chord recognition matches against major, minor, diminished, and augmented triads only. With it, the full template set is in play — the sevenths and ninths, the sixths, 7sus4, the elevenths and thirteenths, and the altered dominants.
The meter search only ever reports a numerator it was asked to score, and the default set is 3,4,6 — so a 5/4, 7/8, or 11/8 piece comes back as one of those three unless you widen the set with --meter-candidates 3,4,5,7. The list takes 1 to 16 entries, each between 2 and 32; a list outside that is refused after the audio is read (exit 3). --meter-denominator sets the beat unit the result is reported in and does not affect the search. See Meter and grouping for what the two numbers mean.
Output:
> Estimated BPM : 119.78 BPM (conf 100.0%)
> Estimated Key : C major (conf 91.6%)
> Time Signature: 4/4
> Beats: 23The text layout of a report differs between sonare and sonare-cli; the sample output on this page is from sonare. --json is the layout both front-ends share.
With --json, analyze prints one object holding every result above plus timbre, dynamics, rhythm and form; its fields are walked through under The analyze JSON.
bpm
Detect tempo (BPM) only.
sonare bpm music.mp3
sonare bpm music.wav --jsonOutput:
BPM: 119.78key
Detect musical key.
sonare key music.mp3
sonare key music.mp3 --json
sonare key music.mp3 --candidates 5 --profile temperley --modes major-minorOutput:
Key: C major (confidence: 91.6%)JSON Output:
{"root": 0, "mode": 0, "confidence": 0.9161276817321777, "name": "C major"}Useful options:
| Option | Use |
|---|---|
--candidates N | Show the top N ranked key candidates, not only the winner |
--hpss | Analyze harmonic content for cleaner key detection on drum-heavy material |
--loudness-weighted | Weight chroma frames by RMS so quieter passages contribute less |
--high-pass-hz FREQ | Ignore low-frequency energy before key analysis (default 80.0; 0 disables) |
--n-fft N | Analysis window (default 2048, 1 or above) |
--hop-length N | Analysis hop (default 512) |
--modes NAME | Limit candidate modes (default major-minor) |
--profile NAME | Choose the key-profile family (default: chosen by --genre-hint) |
--genre-hint HINT | Let the CLI choose a profile from a genre hint: auto (default), edm, electronic, dance, pop, classical or jazz |
What are key profiles, genre hints, and --high-pass-hz?
- Key profile — a template of how prominent each of the 12 pitch classes tends to be in a given key. The detector compares your song's chroma against these templates and picks the best match. Different families (
ks/krumhansl,temperley,shaath/keyfinder, the Faraldo EDM profiles,bellman/bellman-budge) were tuned on different material, so one may fit your genre better than another. - Genre hint — instead of naming a profile directly, you tell the CLI the rough style and it picks a matching profile for you (e.g. an EDM hint selects an EDM-tuned profile).
--high-pass-hz— a high-pass filter removes energy below the given frequency before key analysis, so bass rumble or sub kick doesn't skew the chroma. The default is 80 Hz; 80–120 Hz is typical.- Tuning —
key,chordsandanalyzemeasure the recording's tuning from the audio; there is no tuning flag.
beats
Detect beat times.
sonare beats music.mp3
sonare beats music.mp3 --jsonOutput:
Beat times (23 beats):
1. 0.464s
2. 0.975s
3. 1.486s
...onsets
Detect onset times (note attacks).
sonare onsets music.mp3
sonare onsets music.mp3 --jsonsections
Split a song into sections (intro, verse, chorus and so on) and name its overall form. See Section structure for what the labels mean.
sonare sections music.mp3
sonare sections music.mp3 --json| Option | Default | Description |
|---|---|---|
--min-duration-sec | 4.0 | Shortest section to keep, in seconds (0 or above) |
--threshold | 0.22 | Boundary detection threshold (0 or above) |
--n-fft, --hop-length | 2048, 512 | Analysis framing |
JSON Output:
{"form": "??", "count": 2, "sections": [{"type": "unknown", "start": 0.0, "end": 5.967528343200684, "energy": 1.0, "confidence": 0.0, "group": 0}, ...]}form is the overall pattern as letters, or ? when no repeated structure was found. count is the number of entries in sections, each with its type, start and end in seconds, energy, confidence and group.
Feature Commands
mel
Compute a Mel spectrogram and print its dimensions.
sonare mel music.mp3
sonare mel music.mp3 --n-mels 80
sonare mel music.mp3 --fmin-hz 40 --fmax-hz 16000 --htk| Option | Default | Description |
|---|---|---|
--n-mels | 128 | Number of Mel bands |
--fmin-hz FREQ | 0.0 | Lowest Mel-band frequency in Hz (0 or above) |
--fmax-hz FREQ | the Nyquist frequency | Highest Mel-band frequency in Hz (above 0) |
--htk | off | Use the HTK Mel scale instead of the Slaney scale |
--n-fft, --hop-length | 2048, 512 | Analysis framing |
Output:
Mel Spectrogram:
Shape: 128 mels x 1034 frameschroma
Compute chromagram (pitch class distribution).
sonare chroma music.mp3
sonare chroma music.mp3 --jsonOutput:
Chromagram: 12 bins x 1034 frames
Mean energy per pitch class:
C 0.7236 ##################################################
C# 0.4157 ############################
D 0.1901 #############
...spectral
Compute spectral features: centroid, bandwidth, rolloff, flatness, ZCR (zero-crossing rate), and RMS (root mean square level).
sonare spectral music.mp3
sonare spectral music.mp3 --jsonOutput:
Spectral Features:
Feature Mean Std Min Max
centroid 2496.8 3637.4 228.0 10735.8
bandwidth 2367.0 2908.1 393.9 7441.4
rolloff 5033.7 7486.0 258.4 18970.8
flatness 0.0368 0.0963 0.0000 0.4707
zcr 0.0488 0.0766 0.0078 0.3438
rms 0.0913 0.0127 0.0721 0.1402pitch
Track pitch over time with the YIN or pYIN fundamental-frequency estimator.
sonare pitch vocal.wav
sonare pitch vocal.wav --algorithm yin| Option | Default | Description |
|---|---|---|
--algorithm | pyin | Pitch algorithm: yin or pyin |
--threshold | 0.1 | YIN threshold (> 0 and <= 1) |
--f0-min-hz | 65.0 | Minimum tracked frequency in Hz (above 0) |
--f0-max-hz | 2093.0 | Maximum tracked frequency in Hz (above 0) |
--hop-length | 512 | Hop length in samples (1 or above) |
--frames | off | With --json, add the per-frame times, f0, voiced_flag and voiced_prob arrays to the summary |
Output:
Pitch Tracking (pyin):
Frames: 1034
Median F0: 329.5 Hz
Mean F0: 330.1 HzMore Commands
Beyond the core set above, both CLIs carry every command below with one option contract. Audio-file analysis and feature commands take --json and a file argument, plus --n-fft and --hop-length where they frame the signal. Listing and preset-inspection commands have their own smaller option sets. Editing commands write a WAV to -o/--output.
More analysis
Room-acoustic command terms
Equivalent room means a useful model inferred from audio, not exact measured geometry. RIR means room impulse response. Room morphing is a creative room effect, not dereverberation.
The metrics these commands report are decay and clarity descriptors: RT60 is the reverberation time, EDT the early decay time, C50 and C80 clarity ratios, and DRR the direct-to-reverberant ratio. Each field is defined in Room Acoustics.
| Command | Description | Notable options |
|---|---|---|
sonare downbeats music.mp3 | Downbeat times (seconds) | — |
sonare chords music.mp3 | Chord progression | See chords |
sonare rhythm music.mp3 | Rhythm primitives (syncopation, groove, regularity) | --start-bpm (120.0), --bpm-min (60.0), --bpm-max (200.0), each above 0 |
sonare dynamics music.mp3 | Dynamics / loudness summary | --window-sec (0.4, above 0), --hop-length (512) |
sonare timbre music.mp3 | Timbre / spectral-shape summary | --n-mels (128) |
sonare lufs music.mp3 | EBU R128 loudness in LUFS (Loudness Units relative to Full Scale, the standard perceptual loudness unit — see Delivery targets) | --series (also emit momentary/short-term series) |
sonare acoustic room.wav | Room-acoustic estimate (RT60/EDT/C50/C80) | See acoustic and estimate-room |
sonare estimate-room room.wav | Equivalent room estimate: volume, dimensions, absorption, DRR, confidence | See acoustic and estimate-room |
sonare synthesize-rir --length 7 --width 5 --height 3 -o rir.wav | Mono RIR from shoebox geometry | See synthesize-rir and room-morph |
sonare room-morph dry.wav --length 12 --width 9 --height 4 -o wet.wav | Creative room-character morph toward a target room | See synthesize-rir and room-morph |
sonare boundaries music.mp3 | Structural transitions plus the novelty curve they were picked from | See boundaries |
sonare melody vocal.wav | Melody contour summary: whether a melody was found, pitch range in octaves, mean frequency, pitch stability, vibrato rate, and the pitch-point count | --threshold (0.1, above 0), --hop-length (256), --f0-min-hz (65.0), --f0-max-hz (2093.0) |
sonare meter music.wav | Basic level meters: peak, RMS, crest, true peak, clipping ratio, silence ratio, DC offset | --clip-threshold-db (the level of a linear 0.999; -120 to 0), --oversample (4; one of 1, 2, 4, 8, 16) |
sonare clipping music.wav | Clipped sample and region detection | --threshold-db (the level of a linear 0.999; -120 to 0), --min-region (1) |
sonare dynamic-range music.wav | Percentile RMS dynamic range | --window-sec (3.0), --hop-sec (1.0), --low-percentile (0.1), --high-percentile (0.95); the percentiles are 0 to 1 |
sonare stereo left.wav --reference right.wav | Stereo correlation and width from left/right files | --reference, the second channel's file; without it the command exits 3 |
sonare phase left.wav --reference right.wav | Phase-scope summary from left/right files | --reference, the second channel's file; without it the command exits 3 |
chords
Chord progression as timed chord symbols. The defaults suit most pop and rock material; reach for the key-context option, or leave HMM decoding on, when a progression flickers between neighboring chords.
sonare chords music.mp3 --json
sonare chords music.mp3 --key-context --key-root C --key-mode major| Option | Default | Description |
|---|---|---|
--min-duration-sec | 0.3 | Shortest chord kept, in seconds |
--smoothing-window | 2.0 | Chroma smoothing window, in seconds (above 0) |
--threshold | 0.5 | Chord detection confidence threshold |
--with-seventh | off | Search the full chord template set instead of triads only |
--chroma-method | cqt | Chroma source: cqt, stft or nnls |
--no-beat-sync | off | Disable beat-synchronous chroma pooling |
--no-hmm | off | Skip the hidden Markov model decoding of the chord sequence |
--hmm-beam-width | 24 | HMM decoder beam width; 0 keeps the full search |
--key-context | off | Bias detection with a key context |
--key-root | C | Root pitch class for --key-context (for example F#) |
--key-mode | major | Mode for --key-context (for example minor) |
--detect-inversions | off | Report inversions (bass note) |
--n-fft, --hop-length | 2048, 512 | Analysis framing |
boundaries
boundaries exposes the whole structural-boundary detector, so it reports the novelty curve along with the boundaries picked from it.
| Option | Default | Description |
|---|---|---|
--threshold | 0.3 | Relative threshold: share of the largest novelty event within --reference-window (0 or above) |
--absolute-threshold | 0.005 | Absolute floor on novelty (0 or above) |
--kernel-size | 64 | Novelty kernel size in frames (above 0) |
--n-mfcc | 13 | MFCC coefficients in the feature stream (above 0) |
--n-chroma | 12 | Chroma bins in the feature stream (above 0) |
--peak-distance | 2.0 | Minimum spacing between boundaries, in seconds (0 or above) |
--reference-window | 60.0 | One-sided span for the relative threshold, in seconds; 0 disables the relative threshold |
--no-mfcc, --no-chroma | off | Drop one feature stream |
--n-fft, --hop-length | 2048, 512 | Analysis framing |
The two thresholds do different jobs. --threshold is relative, so it cannot ask whether anything changed at all; --absolute-threshold is the floor that can. detectBoundaries(request) explains the pair and what lowering the floor will and will not recover. Giving both --no-mfcc and --no-chroma is refused after the audio is read (exit 3), because the two streams are combined frame for frame and neither leaves nothing to combine.
acoustic and estimate-room
acoustic measures decay and clarity from a recording. estimate-room goes one step further and infers an equivalent room.
| Option | Default | Description |
|---|---|---|
--ir | off | acoustic: treat the input as an impulse response |
--n-octave-bands | 6 | acoustic: number of octave bands reported |
--min-decay-db | 30.0 | acoustic: minimum decay depth, in dB |
--noise-floor-margin-db | 10.0 | acoustic: margin above the noise floor, in dB |
--aspect-lw | 1.0 | estimate-room: length-to-width prior |
--aspect-lh | 1.0 | estimate-room: length-to-height prior |
--reference-absorption | 0.15 | estimate-room: absorption prior |
--sabine | off | estimate-room: use the Sabine model instead of the default Eyring model |
--n-octave-bands | library default | estimate-room: analyzer octave-band count (1 or above) |
Room-acoustic fields such as RT60, EDT, C50, C80, D50, volume, dimensions, absorption bands, DRR, generated RIR error state, and confidence are explained in Room Acoustics.
synthesize-rir and room-morph
synthesize-rir builds a mono room impulse response from shoebox geometry. room-morph moves a dry recording toward a target room as a creative effect. Both take the same room options.
| Option | Default | Description |
|---|---|---|
--length, --width, --height | 7.0, 5.0, 3.0 | Room dimensions in metres; a non-positive or out-of-bounds dimension is refused with exit 3 |
--absorption | 0.2 | Uniform wall absorption, 0 to 1 |
--source-x, --source-y, --source-z | scaled to the room | Source position in metres; the default sits at 1.0, 1.0, 1.2 in the default room and scales with larger ones |
--listener-x, --listener-y, --listener-z | scaled to the room | Listener position in metres; the default sits at 5.0, 4.0, 1.7 in the default room and scales with larger ones |
--ism-order | 3 | Image-source reflection order |
--seed | 1 | Seed for the late tail, so a render repeats exactly (0 or above) |
--max-sec | natural length | Cap on the RIR or tail length in seconds (above 0) |
--sabine | off | Use the Sabine late-reverb model instead of the default Eyring model |
--sample-rate | 48000 | synthesize-rir only: output sample rate, 8000 to 384000 |
--wet | 0.5 | room-morph only: target-room mix, 0 to 1 |
--suppression | 0.5 | room-morph only: how strongly the source room's tail is suppressed, 0 to 1 |
--receiver-spacing | fitted to the room | room-morph only: metres between the two receivers (above 0 up to 4); omitted, it is 0.5 where the pair fits around the listener and otherwise the largest spacing that fits. Used for a two-channel file, which is morphed as a stereo pair and written as a stereo file |
More features
| Command | Description | Notable options |
|---|---|---|
sonare onset-strength music.mp3 | Onset strength envelope (how strongly notes attack over time); --json carries count, peak_time, stats and the full values array | --n-fft (2048), --hop-length (512), --n-mels (128) |
sonare tempogram music.mp3 | Autocorrelation tempogram | --n-fft, --hop-length, --n-mels, --win-length (384) |
sonare fourier-tempogram music.mp3 | Fourier tempogram | --win-length (384), --hop-length (512) |
sonare tempogram-ratio music.mp3 | Tempo-ratio features | --win-length (384), --hop-length (512) |
sonare plp music.mp3 | Predominant local pulse | --n-fft, --hop-length, --n-mels, --win-length (384), --bpm-min, --bpm-max (both above 0, no default) |
sonare nnls-chroma music.mp3 | NNLS chromagram | --hop-length (512; 1 to 65536) |
sonare tonnetz music.mp3 | Tonal centroid features | --n-fft, --hop-length |
sonare cqt music.mp3 | Constant-Q transform summary; refuses when the highest bin reaches Nyquist, with must be less than sample_rate / 2 in both CLI front ends | --n-bins (84), --bins-per-octave (12), --hop-length (512; 1 to 65536), --fmin-hz (the library default, 32.7 Hz) |
sonare vqt music.mp3 | Variable-Q transform summary | --n-bins (84), --bins-per-octave (12), --gamma (derived from the ERB bandwidths; 0 or above), --filter-scale (1.0), --hop-length (512; 1 to 65536), --fmin-hz (the library default) |
sonare mel-to-audio music.mp3 -o recon.wav | Reconstruct audio from a computed Mel spectrogram with Griffin-Lim | --n-iter (32), --n-fft, --hop-length, --n-mels, --fmin-hz (0.0), --fmax-hz (the Nyquist frequency) |
sonare mfcc-to-audio music.mp3 -o recon.wav | Reconstruct audio from computed MFCCs via Mel + Griffin-Lim | --n-mfcc (20), --n-iter (32), --n-fft, --hop-length, --n-mels, --fmin-hz (0.0), --fmax-hz (the Nyquist frequency) |
sonare pcen --values 1,2,3,4,5,6 --n-bins 2 --n-frames 3 | Per-channel energy normalization over a flattened matrix. Takes --values like the numeric helpers | --n-bins, --n-frames (both required), --sample-rate (22050), --time-constant (0.4), --gain (0.98), --bias (2.0), --power (0.5), --eps (1e-06), --hop-length (512) |
The matrix-feature commands print summaries rather than dumping full arrays. For full feature matrices, use the Python API or the JavaScript API.
Playback
playback renders movie audio (mono, stereo, 5.1 or 7.1) to speaker layouts or binaural headphones, and is the only command that keeps 5.1 and 7.1 channels. Options: --target (headphones, stereo, 5.1, 7.1; headphones), --input-layout (auto, mono, stereo, 5.1, 7.1; auto), --config FILE, --no-upmix, --night (0 to 1; 0.0), --dialogue-db (-12 to 12; 0.0), --program-lufs (-70 to 0; measured from the whole input when omitted), --target-lufs (-40 to -5; -24.0), --room (none, living-room, home-theater, screening-room) and --hrtf FILE; -o is required. Both CLIs render through an existing renderer's offline path, so the output matches the library's renderOffline for the same configuration. The stages, config keys and examples are on Playback Renderer. Duplicate document keys in --config are refused before applying flag overrides. The command exits with code 5.
Utility Commands
info
Display audio file information; --json prints the same fields for a script.
sonare info music.mp3 Duration: 0:12 (12.0s)
Sample Rate: 44100 Hz
Samples: 529200version
Display version information: sonare version, sonare version --json or sonare --version.
libsonare 2.0.0 (Python CLI)doctor
Report what this build can actually do — the first command to run when a feature seems missing or a file will not decode. Both CLIs have it, and it prints the build-diagnostics report the bindings expose as capabilities. The --json fields match across the two CLIs; the native text layout differs (it starts with libsonare Doctor and prints Version: and ABI: project 3, engine 4), and the sample below is the Python CLI's.
sonare doctor # or --jsonlibsonare 2.0.0
Library: /path/to/libsonare.dylib
Platform: darwin-arm64
ABI: project=3, engine=4
Features: mastering=True, mixing=True, fx=True, ffmpeg=True
Decode (built-in): wav, mp3
Decode (FFmpeg): m4a, aac, flac, ogg, opus, wma
SIMD: neon
Hardware concurrency: 18The --json result also lists every feature flag (mastering, mixing, mixingAssistant, arrangement, pitchEditor, voiceChanger, acousticSim, playback, and others). An ffmpeg=false build explains an M4A/AAC/FLAC/OGG decode failure, and the feature flags tell you which command groups were compiled in.
system-info
system-info prints what the machine offers and what this build's parallel scheduler will do with it: the logical and physical core counts, total and available memory, and whether parallel execution is enabled, with the worker count and strategy it derived from the core count. It takes no arguments.
sonare system-info
sonare system-info --jsonOutput (from one machine; the values are that machine's):
System Information
CPU Cores: 18 logical, 18 physical
Memory: 128.0 GB total, 58.7 GB available
Parallel Configuration
Parallel Enabled: yes
Workers: 16
Strategy: aggressive_parallelThe strategy is one of sequential_only, conservative_parallel, balanced_parallel, and aggressive_parallel, picked at 1, 2, 4, and 8 logical cores. The --json form nests the same values under cpu (logical_cores, physical_cores), memory (total_gb, available_gb), and parallel (enabled, workers, strategy). Run it when a batch is slower than expected, or before deciding how many sonare processes to run side by side; doctor is the command for what the build can decode and which feature groups were compiled in.
Numeric Helpers
The twelve numeric helpers mirror librosa.util and the librosa conversion functions: frame/sample conversion, the four decibel conversions, framing, padding, length fixing, peak picking and vector normalization. They let a script ported from librosa check a number against the engine without a binding call, so their reader is someone reproducing a calculation, not analyzing a song. They take no audio file. Two take a single integer, frames-to-samples --frames N and samples-to-frames --samples N; the other ten take a comma-separated list through --values, which is required. (pcen also takes --values but is a feature command, listed under More features.) A missing --values is a usage error (exit 2), and so is an empty list or an element that is not a finite number (argument --values: must be a comma-separated list of finite numbers). Plain output is the result as one comma-separated line, and --json prints a bare JSON array, except where a table below says otherwise. --json spells floating-point numbers differently on the two CLIs (1.0 against 1); the values are the same.
Frame and sample conversion
| Command | Result | Options |
|---|---|---|
sonare frames-to-samples --frames 10 | Sample index of frame N: N * hop, plus n_fft / 2 when --n-fft is given | --frames (required), --n-fft (no centring offset; at least 1), --hop-length (512; at least 1) |
sonare samples-to-frames --samples 6144 | Frame index holding sample N: floor(N / hop), or floor((N - n_fft / 2) / hop) when --n-fft is given | --samples (required), --n-fft (no centring offset; at least 1), --hop-length (512; at least 1) |
Without --n-fft the conversion is the plain N * hop, as librosa's n_fft argument defaults to none; give --n-fft 2048 for the centring offset of a centred STFT. --json wraps the number as {"samples": N} or {"frames": N} rather than printing a bare array.
sonare frames-to-samples --frames 10 # 5120
sonare frames-to-samples --frames 10 --n-fft 2048 # 6144
sonare samples-to-frames --samples 6144 --n-fft 2048 --json # {"frames": 10}Decibel conversion
| Command | Result | Options |
|---|---|---|
sonare power-to-db --values 1,0.1 | 10 * log10(max(v, amin)) - 10 * log10(max(ref, amin)), then floored at max - top_db | --ref (1.0), --amin (1e-10), --top-db (80.0) |
sonare amplitude-to-db --values 1,0.1 | The same on squared input, so 20 * log10 of the amplitude | --ref (1.0), --amin (1e-5), --top-db (80.0) |
sonare db-to-power --values 0,-10 | ref * 10^(v / 10) | --ref (1.0) |
sonare db-to-amplitude --values 0,-20 | ref * 10^(v / 20) | --ref (1.0) |
A zero or negative --ref uses the largest magnitude in the list as the reference, so the loudest entry comes out as 0 dB. A negative --top-db turns the floor off. --amin must be finite and positive; the library refuses anything else (exit 3). The two --amin defaults differ on purpose: the amplitude floor is the square root of the power floor, which is what makes amplitude-to-db agree with power-to-db on squared values.
sonare amplitude-to-db --values 1,0.1 # 0,-20
sonare db-to-amplitude --values 0,-20 --json # [1.0, 0.10000000149011612]Framing, padding, and length
| Command | Result | Options |
|---|---|---|
sonare frame-signal --values ... --frame-length 4 --hop-length 2 | Overlapping frames of the list, flattened row by row: frame i copies input entries [i * hop, i * hop + L) and occupies output positions [i * L, (i + 1) * L) | --frame-length (required), --hop-length (required) |
sonare pad-center --values 1,2,3 --size 7 | The list centred in size entries, with (size - n) / 2 of padding on the left | --size (required, at least 1 and at least the list length), --pad-value (0.0) |
sonare fix-length --values 1,2,3 --size 5 | Exactly size entries: cropped from the right, or padded on the right | --size (required, at least 1), --pad-value (0.0) |
sonare fix-frames --values 0,3,3,7 --x-max 6 | Integer frame indices with entries outside [x-min, x-max] dropped, the bounds inserted, and duplicates removed | --x-min (0), --x-max (no upper bound; 0 or more), --no-pad (do not insert the bounds) |
frame-signal follows librosa.util.frame: the frame count is floor((n - L) / hop) + 1, and a list shorter than the frame length yields nothing. Its --json is an object, {"n_frames": N, "frames": [...]}, rather than the bare array the other helpers print. Neither --frame-length nor --hop-length has a default, because the library takes none.
fix-frames is the one helper that reads integers, and the one place this CLI departs from librosa: the list must be non-decreasing, and a negative entry is refused whenever --x-min is not negative (both exit 3). An empty list is refused as a --values usage error rather than padded to [x-min], because a frame at 0 that no detector produced is indistinguishable from a real one.
sonare frame-signal --values 1,2,3,4,5,6 --frame-length 4 --hop-length 2 --json
# {"n_frames": 2, "frames": [1.0, 2.0, 3.0, 4.0, 3.0, 4.0, 5.0, 6.0]}
sonare pad-center --values 1,2,3 --size 7 # 0,0,1,2,3,0,0
sonare fix-length --values 1,2,3 --size 5 # 1,2,3,0,0
sonare fix-frames --values 0,3,3,7 --x-max 6 # 0,3,6Peak picking and normalization
| Command | Result | Options |
|---|---|---|
sonare peak-pick --values ... | Indices of local maxima, as librosa.util.peak_pick: x[i] is the maximum over [i - pre_max, i + post_max), is at least the mean over [i - pre_avg, i + post_avg) plus delta, and lies at least wait entries after the previous peak | --pre-max, --post-max, --pre-avg, --post-avg, --delta, --wait (all required) |
sonare vector-normalize --values 3,4 --norm-type 2 | The list divided by its norm | --norm-type (0): 0 max-abs, 1 L1, 2 L2, 3 power (sum of squares); --threshold (0.0) |
peak-pick has no defaults, because the library takes none for any of its six parameters. It prints integer indices, so its --json is an integer array. A --norm-type outside 0 to 3 is a usage error (exit 2) rather than a fall back to the max-abs norm. --threshold is the norm at or below which the list comes back unchanged instead of being divided by something near zero, which is librosa's fill=None behavior; at the default 0.0 only an all-zero list is returned as it is.
sonare peak-pick --values 0,1,0,3,0,2,0,1,0 --pre-max 1 --post-max 1 --pre-avg 1 --post-avg 1 --delta 0.5 --wait 0 # 1,3,5,7
sonare peak-pick --values 0,1,0,3,0,2,0,1,0 --pre-max 2 --post-max 2 --pre-avg 1 --post-avg 1 --delta 0.5 --wait 0 # 1,3
sonare vector-normalize --values 3,4 --norm-type 2 # 0.6,0.8