Nodes/MOSS-TTS-ComfyUI/MOSS-TTS v1.5 Estimate Tokens
ComfyUI Node

MOSS-TTS v1.5 Estimate Tokens

The Tiny MOSS-TTS Node That Makes Duration Control Actually Work

By CloudRipple·Created about 24 hours ago·Updated about 23 hours ago· 0
MOSS-TTS v1.5 Estimate Tokens
    • target_tokens
    text
    words_per_minute150

    Estimate Tokens is the unglamorous node in the MOSS-TTS v1.5 pack, and it might be the one that saves your workflow. Its entire job is to convert text into a target_tokens number - the duration hint that every generator node in this pack accepts. Type a line, get a frame count, wire it in, and your clip comes out close to the length you wanted instead of whatever the model felt like.

    It exists because MOSS-TTS generates audio in frames at 12.5 frames per second, and nobody wants to do that arithmetic by hand. The node does it for you.

    How it works

    It's a pure heuristic - no model involved, instant output. It counts the words in your text, divides by the speaking rate, and converts to frames:

    units / (words_per_minute / 60) seconds  ×  12.5 frames/sec  =  target_tokens
    

    The one piece of smartness is language detection: if the text looks like CJK (Chinese, Japanese, Korean), it counts characters instead of words, because that's how those languages actually measure pace. So the words_per_minute input doubles as characters-per-minute for CJK.

    Inputs and output

    • text - the same text you're about to feed the generator node. Keep them identical; the estimate is only as good as the text you give it.
    • words_per_minute - default 150 (range 60–400). This is your speaking-rate assumption. 150 is a reasonable default for English narration; slow it to ~120 for a laid-back documentary voice, speed it up for an ad read. For CJK text, this is characters-per-minute.

    Output is a single target_tokens INT. Wire it into the target_tokens input of Generate Speech, Voice Clone, or Continue Speech.

    How to use it in a real workflow

    Drop an Estimate Tokens node next to your generator, paste the same text into both, and connect the INT output. That's the whole integration - it replaces the "guess a duration, regenerate three times" loop with "set it once."

    One honest caveat: it's an estimate, not a promise. target_tokens is a hint - with 0 the model decides its own length via its end-of-speech token, and even with a hint the model can still end early on a natural pause. For spoken-word pacing it's usually within a few percent, which is all you need for a talking-head pipeline where the video doesn't care about the exact frame.

    Install

    Same pack, same one-time setup as every other node here:

    cd ComfyUI/custom_nodes
    git clone https://github.com/CloudRipple/MOSS-TTS-ComfyUI.git
    python install.py
    

    or ComfyUI Manager → search moss-tts → Install, then restart. There's no per-node install - you get all five nodes with the pack, and this one doesn't even need the model loaded to give you its answer.

    CategoryMOSS-TTS v1.5

    Inputs (2)

    NameTypeDefaultDescription
    textSTRING
    words_per_minuteFLOAT15060–400Speaking-rate assumption. For CJK this is characters-per-minute.

    Outputs (1)

    NameTypeDescription
    target_tokensINT