Separate audio into HPSS, NMF or repetition components
audio_separateSplit 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
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Input audio file path. | |
| range | No | Only process this window ({start_sec, end_sec}, in seconds); the output contains just the window. Omit for the whole file. | |
| detail | No | 'concise' returns the summary and the most useful fields; 'full' returns all. | concise |
| format | No | Output 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. | |
| method | No | '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 |
| prefix | No | File name prefix; files are named '<prefix>.<tool>.<part>.<ext>'. Default: the input's stem. | |
| dry_run | No | Report the resolved output plan and paths without processing or writing. | |
| quality | No | Lossy 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_init | No | nmf only: 'nndsvd' (deterministic, default) or 'random' initialization. | nndsvd |
| aggregate | No | nnFilter only: how similar frames are combined: 'median' (default), 'mean', 'min' or 'max'. | median |
| bit_depth | No | PCM bit depth for wav/flac/aiff: 16, 24 or 'float32' (32-bit float; not flac). Default: the input's depth, else 24. Excludes quality. | |
| overwrite | No | Replace an existing output file. Without it an existing file is an error. | |
| output_dir | No | Directory for the output files. Default: the output directory. | |
| sample_rate | No | Output sample rate in Hz; the audio is resampled when it differs. Default: the input's rate. Opus is always 48000. | |
| n_components | No | nmf only: number of components, 2-16 (default 4). | |
| with_residual | No | hpss only: also write the residual (what neither part claimed). This switches to binary masks, because with soft masks the residual is silent. |