tongflow-modal-sam-audio

July 17, 2026 · View on GitHub

Official TongFlow plugin. Text-prompted sound separation with SAM-Audio (Meta, facebook/sam-audio-large), running on a GPU via Modal.

Capabilities

  • Noise reduction (denoise_audio) — isolate the clean speech from a noisy recording.
  • Vocal separation (separate_audio_track) — pull the vocals out of a mix.
  • Extract track (music-extract) — isolate any sound described in free text ("dog barking", "the piano in the background", "drums"), not just fixed stem names.
  • Separate sound (separate-sound) — split the audio into a described target and the residual (everything else) in one pass, so the same node covers "extract this sound" and "remove this sound". Optional time spans mark where the target occurs, which also enables picking out one specific speaker.

Credentials

Add in TongFlow Settings (gear icon, top-right):

KeyRequiredNotes
MODAL_TOKEN_IDCreate at modal.com/settings/tokens.
MODAL_TOKEN_SECRETPaired with MODAL_TOKEN_ID.
HF_TOKENThe checkpoint is gated: request access on facebook/sam-audio-large, then use that account's token.

On first use the plugin deploys to your Modal account automatically and caches the build; weights are cached on a shared Modal volume.

Tuning (env, optional)

EnvDefaultNotes
SAM_AUDIO_MODELfacebook/sam-audio-largeAny facebook/sam-audio-* variant.
SAM_AUDIO_RERANK4Candidates re-ranked per call; higher = better/slower.
SAM_AUDIO_PREDICT_SPANS1Predict where the target sound occurs first.
SAM_AUDIO_DENOISE_PROMPTclear speechWhat denoise_audio keeps.
SAM_AUDIO_VOCALS_PROMPTsinging vocalsWhat separate_audio_track keeps.
SAM_AUDIO_MAX_SECONDS300Longest accepted input.