Nodes/Meta SAM-Audio/SAM-Audio Span Prompt
ComfyUI Node

SAM-Audio Span Prompt

Building positive and negative time spans

By ethanfel·Created 23 days ago·Updated 8 days ago· 4
SAM-Audio Span Prompt
  • spans
  • spans
polarity
start_time0.00
end_time1.00

Text prompting gets you most of the way with SAM-Audio. Spans get you the rest. This node exists for the moments when "car honking" works but the model keeps pulling in the truck horn from a different lane - you stop describing and start pointing: this second of audio is the target, that section isn't.

A span is a time window with a polarity. A positive span says "the target sound is present here," a negative span says "the target sound is absent here." That negative is the underrated half: if your speaker goes quiet during a guitar solo and the model keeps trying to separate the solo as if it were speech, a negative span over those seconds tells it to leave that stretch alone.

How it works

This is a pure builder node - no model, no audio, no compute. Each one you add appends a single SpanPrompt to a chain and hands the chain out as a SAM_AUDIO_SPANS value. The optional spans input is where you connect the previous Span Prompt's output, so you can daisy-chain as many windows as you need. It's cheap, so don't be shy: two positives and a negative costs you nothing at runtime.

The three inputs you actually set:

  • polarity - positive or negative, meaning target present or absent.
  • start_time - seconds into the clip where the span begins.
  • end_time - where it ends. Must be greater than start_time; the node raises an error otherwise, which is a nice reminder that a span of zero length is useless.

All times are absolute seconds in the clip, and the node itself has no concept of clip length - it just records what you give it. The separator it feeds does the validation against the actual audio, so you can build a chain before you've even loaded the file.

Where it goes

A span chain has exactly one destination in this pack: SAM-Audio Span Separate, which takes your text description plus the spans and runs the separation with both conditions. You can also reuse a single chain across several separator runs to test different descriptions against the same time windows.

The workflow shape is:

SAM-Audio Model Loader ──► SAM-Audio Span Separate
Load Audio ─────────────► SAM-Audio Span Separate
SAM-Audio Span Prompt ──► SAM-Audio Span Separate   (chain 2-3 of them)

Why you'd bother

If the pack were just the text node, it'd still be a great stem remover - the "take this instrument out" crowd is real. But the span prompt is what makes it feel like a precise tool instead of a shotgun: you're not hoping the model figures out when the target is; you're telling it. Reach for spans when your mixture has something that looks like the target but isn't - a second voice, a similar-sounding instrument - and text alone keeps grabbing the wrong thing. Negative spans in particular will save you a lot of staring at waveforms wondering why the residual still contains your target.

One honest caveat: spans are fiddly to set by hand, and for a single clean instruction ("dog barking" over otherwise quiet audio) you'll get the same result without them. Use them as the escalation, not the default.

Categoryaudio/SAM-Audio

Inputs (4)

NameTypeDefaultDescription
polarityCOMBOWhether the target is present or absent in this span.
start_timeFLOAT0.000–86400
end_timeFLOAT1.000–86400
spansoptSAM_AUDIO_SPANSOptional prior span chain to append to.

Outputs (1)

NameTypeDescription
spansSAM_AUDIO_SPANS