Nodes/RyanOnTheInside/Context Modifier βš‘πŸ…‘πŸ…žπŸ…£πŸ…˜
ComfyUI Node

Context Modifier βš‘πŸ…‘πŸ…žπŸ…£πŸ…˜

A tiny rules engine for Whisper-driven word triggers

By ryanontheinsideΒ·Created 2 years agoΒ·Updated 5 months agoΒ· 852
Context Modifier βš‘πŸ…‘πŸ…žπŸ…£πŸ…˜
  • trigger_set
  • TRIGGER_SET
β—„modifier_typetimingβ–Ί
β—„conditionduration > 0.5β–Ί
β—„value_adjust1.20β–Ί
β—„window_size3β–Ί

This one's a step up in cleverness from the pack's other reactive nodes. Instead of a raw numeric signal (audio amplitude, brightness, beat), it works on TRIGGER_SET - the pack's Whisper-transcription-based system, where each spoken word becomes a timed trigger. Context Modifier lets you write an actual Python condition that decides, word by word, whether to amplify or dampen that word's trigger strength. If you've ever wanted "make every long, emphasized word hit harder" or "boost trigger strength right after a speaker change," this is the node that does it.

How it works

You pick a modifier_type - the lens the condition gets evaluated through - and then write condition as a small Python expression using whatever variables that lens exposes. Per the tooltips: timing exposes duration, start, end (word-level timing); sentiment exposes is_positive, sentiment_score; speaker exposes speaker_id, is_new_speaker; and sequence exposes index, total_words. The default condition, duration > 0.5, is a timing example - any word that takes longer than half a second to say gets flagged. Whenever the condition evaluates true for a given word, that word's trigger value gets multiplied by value_adjust (above 1.0 amplifies, below 1.0 reduces, 1.0 is a no-op). window_size controls how many neighboring words get considered as context for the evaluation - a larger window gives the condition more surrounding words to reason about, at the cost of being less locally responsive.

The inputs and outputs that matter

  • trigger_set (TRIGGER_SET, required) - the incoming word-level trigger set from an upstream Whisper transcription node.
  • modifier_type - timing, sentiment, speaker, or sequence; determines which variables condition can reference.
  • condition (multiline STRING, default "duration > 0.5") - the Python expression that gates the adjustment.
  • value_adjust (default 1.2, range 0–2) - the multiplier applied when condition is true.
  • window_size (default 3, range 1–10) - how many words of context feed into evaluation.

Output: a single TRIGGER_SET, the modified version, ready to chain into another ContextModifier or into whatever downstream node consumes triggers to drive an effect.

How to install it

Via ComfyUI Manager: search "RyanOnTheInside," install, restart. By hand:

cd ComfyUI/custom_nodes
git clone https://github.com/ryanontheinside/ComfyUI_RyanOnTheInside.git
cd ComfyUI_RyanOnTheInside
pip install -r requirements.txt

then restart. The Whisper-based transcription this node's input depends on is a heavier piece of machinery than most of the pack - expect the upstream transcription node to pull a Whisper model on first use, separately from this node itself.

Common issues & troubleshooting

condition throws an error instead of modifying anything. It's a real Python expression evaluated against a specific set of variables, and those variables change depending on modifier_type. Writing is_positive while modifier_type is set to timing will fail - match the variable names in your condition to the tooltip's list for whichever mode you actually picked.

Nothing seems to change even with a valid condition. Check value_adjust isn't sitting at 1.0 - that's a mathematical no-op regardless of how many words your condition matches.

The effect feels inconsistent between similar-sounding words. That's window_size - a small window makes the evaluation very locally sensitive to just that word and its immediate neighbors, which can look noisy on natural speech. Try widening it if you want smoother, more contextual behavior rather than word-by-word jitter.

Unsure what upstream node actually produces a TRIGGER_SET. This node modifies an existing trigger set - it doesn't create one from raw audio itself. You need a Whisper-transcription source node earlier in the chain to generate the TRIGGER_SET this one consumes.

CategoryRyanOnTheInside/FlexFeatures/Sources/Whisper

Inputs (5)

NameTypeDefaultDescription
trigger_setTRIGGER_SETInput trigger set to modify based on context
modifier_typeCOMBOtimingType of context to consider: - timing: Word duration and position in sentence - sentiment: Positive/negative emotional context - speaker: Speaker identity and changes - sequence: Patterns in word sequence
conditionSTRINGduration > 0.5Python expression that determines when to apply modification. Available variables depend on modifier_type: - timing: duration, start, end - sentiment: is_positive, sentiment_score - speaker: speaker_id, is_new_speaker - sequence: index, total_words
value_adjustFLOAT1.200–2How much to modify trigger values: 1.0 = no change >1.0 = amplify effect <1.0 = reduce effect
window_sizeINT31–10Number of words to analyze for context. Larger windows provide more context but may be less responsive.

Outputs (1)

NameTypeDescription
TRIGGER_SETTRIGGER_SETβ€”