Skip to main content
Glama
libsonare-mcp

libsonare-mcp

Official
by libraz

Separate audio into HPSS, NMF or repetition components

audio_separate
Destructive

Split an audio file into signal-based components: harmonic/percussive parts, NMF components, or repeating background vs. foreground; use it to isolate drums from sustained pads or prepare analysis.

Instructions

Splits an audio file into component files: method 'hpss' gives a harmonic (sustained tones) and a percussive (hits, transients) part, optionally with a residual; method 'nmf' factorizes the spectrogram into 2-16 components that add back up to the input (linked across channels for stereo, seeded by 'nmf_init'); method 'nnFilter' splits a repeating background from a non-repeating foreground by nearest-neighbor filtering of the spectrogram. Separation is signal-based (HPSS, NMF, nearest-neighbor masks), NOT a learned stem-separation model: the components are not named instruments, and a vocal cannot be cleanly isolated from a mix. Use it to pull drums away from sustained pads, to listen to what an NMF component holds, or as preparation for analysis. Do not use it to cut a file in time (audio_split) or to correct a voice (audio_vocal). Long inputs are limited; pass a 'range'. Example: {"path": "song.wav", "method": "hpss", "with_residual": true}.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "path": "<path>"
    },
    "name": "audio_separate"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesInput audio file path.
rangeNoOnly process this window ({start_sec, end_sec}, in seconds); the output contains just the window. Omit for the whole file.
detailNo'concise' returns the summary and the most useful fields; 'full' returns all.concise
formatNoOutput format: wav, flac, ogg (Vorbis), opus, mp3, aiff, or m4a (AAC, needs ffmpeg). Default: the explicit output's extension, else the input's format, else wav.
methodNo'hpss' splits into a harmonic (sustained) and a percussive (transient) part; 'nmf' factorizes the spectrogram into n_components parts, each with the original phase, that add back up to the input; 'nnFilter' splits into a repeating background and the foreground that does not repeat (a voice over a loop), with the phase rebuilt by Griffin-Lim.hpss
prefixNoFile name prefix; files are named '<prefix>.<tool>.<part>.<ext>'. Default: the input's stem.
dry_runNoReport the resolved output plan and paths without processing or writing.
qualityNoLossy encoder setting for ogg/opus/mp3, 0..1 (soundfile compression_level, variable bit rate): 0 = best quality, 1 = smallest file. On 48 kHz stereo music, mp3 0 / 0.3 / 1 is about 192 / 120 / 55 kbit/s (no 320 kbit/s setting), ogg about 330 / 150 / 45 and opus about 510 / 360 / 13. Default 0.3. Excludes bit_depth.
nmf_initNonmf only: 'nndsvd' (deterministic, default) or 'random' initialization.nndsvd
aggregateNonnFilter only: how similar frames are combined: 'median' (default), 'mean', 'min' or 'max'.median
bit_depthNoPCM bit depth for wav/flac/aiff: 16, 24 or 'float32' (32-bit float; not flac). Default: the input's depth, else 24. Excludes quality.
overwriteNoReplace an existing output file. Without it an existing file is an error.
output_dirNoDirectory for the output files. Default: the output directory.
sample_rateNoOutput sample rate in Hz; the audio is resampled when it differs. Default: the input's rate. Opus is always 48000.
n_componentsNonmf only: number of components, 2-16 (default 4).
with_residualNohpss only: also write the residual (what neither part claimed). This switches to binary masks, because with soft masks the residual is silent.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already flag destructive=true and openWorld=false, but the description adds the crucial expectation-setting that separation is signal-based, that components are not named instruments, and that a vocal cannot be cleanly isolated from a mix — behavior an agent could not infer from annotations or schema. It also discloses the soft-vs-binary mask side effect of with_residual and the long-input limit.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loads the three methods, then the not-a-stem-model caveat, then do/don't guidance, then the range limit and an example — a logical order for an agent scanning for fit. It is long for one paragraph and the method summaries partially echo the enum descriptions in the schema, which is minor redundancy but not wasted space given 16 parameters.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive, 16-parameter tool this covers what an agent most needs: what each mode produces, what it is not good for, when to route elsewhere, and the long-input workaround. Output file naming and dry_run semantics are handled by the schema, so their absence here is acceptable, though the cost/side effects of writing multiple files are only implied.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3; the description still adds meaning by noting NMF components are linked across channels for stereo, are seeded by nmf_init, and add back up to the input — relationships the schema lists but does not connect. The worked example anchors a minimal valid call. Remaining parameters (format, quality, bit_depth, detail) are left entirely to the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Splits an audio file into component files') and then precisely defines all three modes — hpss harmonic/percussive, nmf additive components, nnFilter repeating background vs non-repeating foreground. It explicitly distinguishes itself from siblings audio_split and audio_vocal, and rules out the common misconception that it performs learned stem separation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives concrete positive triggers ('pull drums away from sustained pads', 'listen to what an NMF component holds', preparation for analysis) and explicit negative routing ('Do not use it to cut a file in time (audio_split) or to correct a voice (audio_vocal)'). It also states the constraint that long inputs require a 'range'.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.