sourcery

sourcery · effects

SOURCERY — a two-input region-transplant recolorizer video PROCESSOR. It edge-detects video A (top) and video B (bottom), segments each edge map into bounded regions (the connected non-edge areas walled off by the detected edges), then for every region in A finds the B region most similar in SHAPE (angles + geometry) first and SIZE second, and paints A's region with B's colors placed at the SAME relative position inside the shape (a corner of A samples the matching corner of B). A B shape may be reused by many A regions and EVERY part of A maps to some region (tiny/culled regions and the edge walls are absorbed into their nearest surviving region, so the output has no holes — the whole-screen background becomes one giant region filled by some B shape). Two global controls move all the transferred color: SKEW rotates the hue of every filled pixel (bipolar, 0.5 = no shift), ROT rotates the sampling frame inside each region (bipolar, 0.5 = no rotation). The look is a shifting stained-glass / photomosaic where A's edge structure is the cell boundaries and each cell is a warped fragment of B chosen by shape similarity; region boundaries are intentionally BLOCKY (segmentation runs at a coarse 128×96 grid, nearest-upscaled) while the colors are full-res sharp. For real-time performance the shape/segmentation stage is temporally amortized (recomputed every few frames) while the color fill sampling live B runs every frame; on live noisy video at low threshold the regions shimmer/boil frame-to-frame (a disclosed v1 limitation). The CCL, moments, Hu shape descriptors, z-score match and rel→uvB transform are a 1:1 mirror of the pure, unit-tested $lib/video/sourcery-core; the two THRESHOLD knobs (each + a CV input) gate A/B segmentation. Patch a structural source into A and a colorful source into B; with nothing in B the module passes A through (hue-skewed only).

sourcery is a two-input region-transplant recolorizer: it edge-detects video A (top) and video B (bottom), carves each edge map into bounded regions (the connected non-edge areas walled off by the detected edges), then for every region in A finds the B region most similar in SHAPE (angles + geometry) first and SIZE second, and paints A's region with B's colors placed at the SAME relative position inside the shape (a corner of A samples the matching corner of B). A B shape may be matched by many A regions (reuse is fine) and EVERY part of the A frame maps to some region (tiny/culled regions and the walls are absorbed into their nearest surviving region, so the output never has holes — the whole-screen background becomes one giant region filled by some B shape). Two global controls move all the transferred color: SKEW rotates the hue of every filled pixel, ROT rotates the sampling frame inside each region. The result is a shifting stained-glass / photomosaic where A's edge structure is the cell boundaries and each cell is a warped fragment of B chosen by shape similarity: as B moves the fills shimmer with B's live color, as A moves the boundaries flow with A's structure. Region boundaries are intentionally BLOCKY (segmentation runs at a coarse 128x96 grid, nearest-upscaled) while the colors are full-res sharp (B is sampled at engine resolution). For real-time performance the shape/segmentation stage is amortized (recomputed every few frames) while the color fill sampling live B runs every frame; on live noisy video at low threshold the regions shimmer/boil frame-to-frame (a disclosed v1 limitation). Usage: patch a structural source into A and a colorful source into B, raise ThrA/ThrB until A's cells and B's shapes read cleanly (higher = fewer, bolder regions), then twist SKEW to tint and ROT to swirl the transplanted color; with nothing in B the module passes A through (hue-skewed).

the faceplate

sourceryavideobvideothresholdAcvthresholdBcvcolorSkewcvrotatecvoutvideoaudiocvgatepitch
6 inputs · 1 outputs · 4 params

inputs

idcablewhat it does
avideoVideo input A (top) — its edge map defines the CELL BOUNDARIES: each connected non-edge area becomes a region that gets painted. With nothing patched here the output is black. A's structure flows the cell layout live.
RGB video stream
bvideoVideo input B (bottom) — its edge map is segmented into candidate SHAPES and its live full-res color is the paint. Each A region samples the B region matched to it (by shape then size) at the same relative position. With nothing patched in B the module passes A through (hue-skewed only).
RGB video stream
thresholdAcvCV input that modulates ThrA — the edge gradient trigger for A's segmentation. Raising it keeps only the strongest contours (fewer, larger A cells); lowering it lets faint gradients wall off more, smaller cells. Linear-scaled into 0..1.
control voltage (CV); modulates thresholdA (additive offset — ±1 CV sweeps the full range, centered on the knob)
thresholdBcvCV input that modulates ThrB — the edge gradient trigger for B's segmentation (the pool of candidate shapes A matches against). Linear-scaled into 0..1.
control voltage (CV); modulates thresholdB (additive offset — ±1 CV sweeps the full range, centered on the knob)
colorSkewcvCV input that modulates Skew — rotates the hue of every transferred pixel. Linear-scaled into 0..1 (0.5 = no shift).
control voltage (CV); modulates colorSkew (additive offset — ±1 CV sweeps the full range, centered on the knob)
rotatecvCV input that modulates Rot — rotates the sampling frame inside each region, swirling the transplanted color. Linear-scaled into 0..1 (0.5 = no rotation).
control voltage (CV); modulates rotate (additive offset — ±1 CV sweeps the full range, centered on the knob)

outputs

idcablewhat it does
outvideoThe recolored video frame: A's edge-bounded cells each painted with the relative-position colors of their shape-matched B region, globally hue-skewed. A normal downstream video texture.
RGB video stream

params

idlabelrangedefaultcurve
thresholdAThrA0..1linear
thresholdBThrB0..1linear
colorSkewSkew0..1linear
rotateRot0..1linear

controls

controlwhat it does
SkewSkew (0..1, default 0.5 = identity): global hue rotation of every transferred color, mapped bipolarly to +/-180 degrees (0.5 = no shift, 0 = -180, 1 = +180). Saturation and value pass through untouched.
RotRot (0..1, default 0.5 = no rotation): rotates the intra-region sampling frame, mapped bipolarly to +/-pi radians, so the color content swirls within each cell while the cell boundaries stay put.
ThrAThrA (0..1, default 0.2): the normalised Sobel gradient magnitude at or above which an A pixel is a wall. 0 floods the frame with walls (many tiny cells); 1 keeps almost nothing (one big cell); 0.2 catches salient contours without low-contrast noise. Applied at segmentation time, so under amortization a twist shows on the next recompute.
ThrBThrB (0..1, default 0.2): the same edge trigger for B's segmentation — sets how finely B is broken into candidate shapes for the match. Higher = fewer, bolder B shapes.

source

sourcery.ts on GitHub.

Generated from packages/web/src/lib/{audio,video}/module-registry.ts · repo