← f_ notebook · docs/f-reference/f_hue_processor.md

f_hue_processor — Bpatcher Spec ​

Last updated: 2026-07-05 (previous doc dated 2026-05-25 described a superseded rslider-based implementation — see Loose Threads)Status: Working, with a known open UI bug (see Loose Threads)

Concept ​

Hue-selective processing. Isolates a flat-topped hue band — centered on hue_center, extending hue_lower degrees below and hue_upper degrees above, with a edge_falloff-degree smoothstep at each boundary — and applies saturation, luminance, and hue-rotation adjustments only within that band. A low-saturation gate (smoothstep(0.05, 0.15, S)) suppresses the effect on near-gray pixels regardless of hue, avoiding hue-selection noise in desaturated regions.

Parameters ​

NameTypeRangeDefaultDescription
hue_centerfloat0–360120.0Hue band center, in degrees
hue_lowerfloat0–18036.0Flat-top extent below center, in degrees
hue_upperfloat0–180156.0Flat-top extent above center, in degrees
edge_fallofffloat0–9010.0Smoothstep falloff width at each boundary, in degrees — 0=hard edge
sat_amtfloat-1–10.0-1=full desaturate, 0=unchanged, 1=full boost, within the band
lum_shiftfloat-1–10.0Additive luminance shift within the band
hue_shiftfloat-180–1800.0Hue rotation within the band, in degrees
bypasstoggle0/10Bypass processing

Signal Chain ​

texture in → jit.gl.pix (HSV decode → flat-top hue-band mask → HSV re-encode)
           → texture out

Parameters routed via the standard route <params...> pattern generated by tools/build_patcher.py — correction (2026-10-12 maintenance audit): hue_center/hue_lower/hue_upper are not "plain live.dial floats routed like any other param." The shipped definition.py marks them type: "internal" with no route token — they are driven via the jsui pair (hue_rslider.js → hue_range.js → attruis), and that wiring is the mechanism behind the band-drag bug below. The saturation/lum/hue adjustment params are routed normally.

Loose Threads ​

  • HANDOFF.md still lists an open bug: "f_hue_processor bugs (hue_lower/hue_upper missing UI path)." Pinned down by the 2026-10-12 maintenance audit (now a formal task, .specify/f_hue_processor/T001): the bug is a UI-wiring disagreement, not shader math. The rslider's ondrag fires output() → hue_range.js → drives the pix, but the parameter-enabled hue_lower/hue_upper live.numboxes' param_connect path goes to the pix directly, while msg_float on inlets 0/1 deliberately suppresses output() (a loop-back guard) — so dragging the band and typing in the numboxes follow two different routes that don't stay in agreement. The codebox's band math itself is correct (and is the precedent f_dither_grain reuses).
  • The underlying hue model changed from whatever the 2026-05-25 doc described to the current hue_center + hue_lower/hue_upper (asymmetric flat-top) + edge_falloff model — worth being aware of if cross-referencing any older notes or muscle memory about this module's dial layout.

References ​

Hue-band selective processing via HSV round-trip with an asymmetric flat-top band (hue_center + hue_lower/hue_upper + edge_falloff) is an original construction; no external source was consulted. The band math (mod(hue - hue_c + 0.5, 1.0) - 0.5, two smoothstep shoulders, saturation gate) is the precedent f_dither_grain reuses (its ADR-4).

The band params are driven via the jsui pair (hue_rslider.js -> hue_range.js), not the standard route -- see Notes for the open band-drag UI bug (now a formal task, .specify/f_hue_processor/T001).

See docs/f-reference/f_hue_processor.md (this file) for the full parameter reference and the bug investigation.

Source File ​

package/patchers/f_hue_processor.maxpat