1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const axios = require('axios');
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/sam-audio-large";
const data = {
"audio": "https://segmind-resources.s3.amazonaws.com/input/05f46d53-2089-473b-be52-c054174952dd-sample_input.mp3",
"description": "a man speaking",
"output_format": "wav",
"reranking_candidates": 4
};
(async function() {
try {
const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } });
console.log(response.data);
} catch (error) {
console.error('Error:', error.response.data);
}
})();Audio file URL or base64 to separate into components.
Describe the sound to isolate, e.g., drums or vocals.
Output audio format. WAV for quality, MP3 for smaller size.
Allowed values:
Number of separation candidates. Higher values improve quality.
min : 1,
max : 8
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
SAM-Audio is a foundation AI model from Meta designed for audio source separation: isolating a target sound (like “drums”, “speech”, or “siren”) from a mixed recording. Instead of separating only fixed stems, SAM-Audio aims to segment any sound you describe, making it useful for modern audio editing pipelines, sound event detection, and multimedia analysis.
On Segmind, you provide an audio input and a sound description prompt. The model returns an isolated track containing the requested source, enabling workflows like “extract vocals from a song”, “remove background noise”, or “pull out footsteps from a scene”.
output_format: wav for highest fidelity; mp3 for smaller files.reranking_candidates (1–8) when the separation is close but imperfect; higher values typically improve selection at the cost of more computation.Core parameters
audio (required): URL/Base64 for the input audio.description (required): the sound to isolate.output_format (optional): wav or mp3 (default wav).reranking_candidates (optional, advanced): candidate count (default 4).Is SAM-Audio open-source?
Meta publishes research assets for SAM-Audio, but licensing and usage terms may vary by distribution. Check the upstream repository/terms for your deployment scenario.
How is SAM-Audio different from stem splitters (vocals/drums/bass)?
It’s prompt-driven: you can target any described sound, not only fixed music stems.
What should I put in description for best results?
Use a concise noun phrase plus qualifiers (instrument, source, environment), e.g., “male speech in a car”, “dog barking”, “hi-hat pattern”.
Should I choose WAV or MP3 output?
Choose WAV for editing and evaluation; choose MP3 for lightweight previews and distribution.
What does reranking_candidates do?
It controls how many separation candidates are generated and reranked; increasing it can improve the final isolated track when prompts are ambiguous.