ComfyUI Node

ORPH_Sample

Sampling audio tokens

By AustinMroz·Created about a year ago·Updated about a year ago· 1
ORPH_Sample
  • model
  • prompt
  • full
  • chunk
  • generated
add_start_tokentrue

ORPH_Sample is the heart of the ComfyUI-Orpheus pack - the node that turns a loaded 3B model plus a tokenized prompt into an actual speech output. It's the autoregressive generation step, and if you've watched an LLM type out text token by token, you already know the feel: the model here isn't typing text, it's emitting audio codes one group at a time, and this node is what makes that happen.

How it works

Orpheus doesn't predict words at generation time - it predicts the discrete token stream produced by the SNAC audio codec. The neat engineering trick is in how the pack forces a vanilla text model to do that: a custom AudioLogitsProcessor masks the logits so that at every step the model can only pick a valid code from the current codebook position (audio codes come in groups of seven across three hierarchical codebooks), plus the end_of_speech token at frame boundaries. Effectively it converts a general-purpose Llama into a speech-code predictor with a straitjacket on, and it works.

The sampling parameters are hardcoded - temperature 0.6, top_p 0.95, repetition penalty 1.1, capped at 7 × 512 = 3584 new tokens (roughly 512 audio frames, so a few seconds of speech per run). You don't get sliders for those; this is a "heavily WIP" pack, remember. The model is moved to GPU for the generation pass and back to CPU afterwards, so it shares VRAM politely with the rest of your graph.

The inputs that matter

  • model (ORPH_MODEL) - straight out of ORPH_Load.
  • prompt (ORPH_TOKENS) - from ORPH_Prompt, or from ORPH_Combine if you've stitched together a multi-turn or voice-cloned prompt.
  • add_start_token (boolean, default on) - whether to prepend the AI/speech section tokens. Leave it on for the normal one-shot flow. If your prompt was already built with those tokens baked in (e.g. you encoded reference audio with ORPH_Encode's BOTH formatting), you may want it off to avoid doubling up.

There's also a reroll button on the node. The code is refreshingly honest about it: the seed is "not something reproducible. Just a 'reroll' counter." Click it to nudge sampling, don't expect it to pin your output.

The outputs (three of them - this is the fiddly part)

  • full - the entire generated sequence including your prompt tokens, plus a closing end_of_ai.
  • chunk - just the speech section, starting at the speech-start token. This is what you normally feed to ORPH_Decode - it's the canonical wiring in the pack's own example workflow.
  • generated - only the newly generated codes, your prompt stripped out. Useful if you want the raw speech tokens with nothing else attached.

So the stock recipe is: Load → Sample, Prompt → Sample, Sample.chunk → Decode → PreviewAudio.

Installing it

The node ships with the pack - ComfyUI Manager (search ComfyUI-Orpheus) or git clone https://github.com/AustinMroz/ComfyUI-Orpheus into custom_nodes, then restart. You still need the weights: Orpheus 3B fp16 (~6 GB) in models/orpheus/ and the SNAC 24 kHz codec in models/vae/. No pip installs - the pack vendors its SNAC code and leans on ComfyUI's bundled transformers.

Common issues

  • Doubled or mangled section tokens. If your prompt came through ORPH_Encode with formatting already applied, and add_start_token is also on, you get two AI-speech openings. Toggle it off.
  • Wrong output wired to Decode. Decode needs the speech tokens. full includes your text prompt's tokens and will decode to garbage; use chunk or generated.
  • Slow. It's a 3B autoregressive Llama running locally; a few seconds per utterance on a decent GPU is normal, not a bug. That's the price of Orpheus's quality tier versus the lightweight TTS corner (Kokoro, Piper) that trades expressiveness for speed.
  • Pack won't load. The torchaudio story again - if the nodes are broken at startup, pip install torchaudio in your ComfyUI env, matching your torch version.

Sample is where the pack earns its keep. Everything else is plumbing around it.

Categorysd

Inputs (3)

NameTypeDefaultDescription
modelORPH_MODEL
promptORPH_TOKENS
add_start_tokenBOOLEANtrue

Outputs (3)

NameTypeDescription
fullORPH_TOKENS
chunkORPH_TOKENS
generatedORPH_TOKENS