POST
javascript
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); } })();
RESPONSE
image/jpeg
HTTP Response Codes
200 - OKImage Generated
401 - UnauthorizedUser authentication failed
404 - Not FoundThe requested URL does not exist
405 - Method Not AllowedThe requested HTTP method is not allowed
406 - Not AcceptableNot enough credits
500 - Server ErrorServer had some issue with processing

Attributes


audiostr *

Audio file URL or base64 to separate into components.


descriptionstr *

Describe the sound to isolate, e.g., drums or vocals.


output_formatenum:str ( default: wav )

Output audio format. WAV for quality, MP3 for smaller size.

Allowed values:


reranking_candidatesint ( default: 1 )

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: Audio Source Separation Model

What is SAM-Audio?

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”.

Key Features

  • Prompted sound isolation using natural language text (e.g., “keyboard typing”, “female narration”).
  • Fine-grained separation for complex mixes (music, ambience, dialogue + effects).
  • Developer-friendly inputs: audio via URL or Base64, with selectable output format.
  • Quality tuning with reranking to improve the best-candidate separation.
  • Strong fit for automated pipelines (moderation, indexing, annotation, post-production).

Best Use Cases

  • Audio editing & post-production: isolate dialogue, ambience, SFX, instruments.
  • Content creation: remixing, stem-like extraction, cleaner voiceovers.
  • Sound event detection: extract target events before classification or labeling.
  • Multimedia & video analysis: separate scene sounds for search and retrieval.
  • Accessibility: enhance speech tracks for transcription and captioning.

Prompt Tips and Output Quality

  • Be specific: “snare drum hits” often separates better than “drums”.
  • Include context: “crowd cheering in a stadium” vs. “cheering”.
  • If multiple similar sources exist, add qualifiers: “lead vocal”, “background chatter”.
  • Use output_format: wav for highest fidelity; mp3 for smaller files.
  • Increase 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).

FAQs

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.