videovarispeed
videovarispeed · sources · schema v1Local-file VIDEO player with a PERFORMANT varispeed transport AND a 7-SLOT ASSET SELECTOR. SINGLE VIDEO: pick/drop a video (objectUrl + optional FileSystemFileHandle for one-click reload; collaborators re-link their own copy — the bytes stay local, only fileMeta syncs); the frame texture is sampled off requestVideoFrameCallback so the `video` output streams at ANY playback speed (the #291 fix). Transport: SPEED knob (0=-4×…0.5=+1×…1=+4×; reverse scrubs at a throttled ~10 Hz), a START/END window, LOOP vs ONE-SHOT, and rising-edge gates START / PAUSE / RESET / LOOP. Stereo `audio_l` / `audio_r` bridge the file's audio (with a silent keep-alive so an unpatched source keeps decoding at full rate). ASSET SELECTOR: right-click the card → "Load multiple…", a 7-row panel (notes C D E F G A B) that loads up to 7 videos, one per slot; all 7 are PRELOADED as separate <video> elements (first frame decoded) so a switch is instant. Patch a clip player's GATE → ASSET GATE and PITCH → ASSET PITCH: on each ASSET GATE rising edge the module reads ASSET PITCH (raw V/oct), maps it to a slot by PITCH CLASS, and — if that slot holds a loaded video — makes it the active source, RESTARTS IT FROM THE BEGINNING (currentTime=0), plays it (if the transport is playing) under the current speed/window/loop settings, and re-wires its audio to the now-active element. THE 7-NOTE → SLOT TABLE (the default clip's in-key rows, C-major from C3): C3 (MIDI 48) → slot 1, D3 (50) → slot 2, E3 (52) → slot 3, F3 (53) → slot 4, G3 (55) → slot 5, A3 (57) → slot 6, B3 (59) → slot 7. Matching is octave-independent (a C in any octave → slot 1, …); a black-key pitch (C# D# F# G# A#) maps to NO slot → the event is IGNORED (current video keeps playing). MEMORY: 7 preloaded <video> elements are heavy, so each slot's file is capped at 100 MB. The displayed selection is LOCAL render state (computed from the synced gate + per-slot fileMeta), never written to the Y.Doc per gate event. ASSET PITCH / ASSET GATE + the transport gates/CV all live in the card's yellow drill-down PATCH PANEL (no raw side jacks, #767 standard).
the faceplate
inputs
| id | cable | what it does |
|---|---|---|
cv_start | gate | Gate (rising-edge / trigger). On the edge it (re)starts playback from the START window point and begins playing; if the window is empty (START past END) it instead seeks the current spot and stays paused. gate / trigger; modulates cv_start (summed directly (the destination DSP scales it)) |
cv_pause | gate | Gate (rising-edge / trigger). Each rising edge toggles pause/unpause — it flips the play state on the edge, it is not level-held. gate / trigger; modulates cv_pause (summed directly (the destination DSP scales it)) |
cv_reset | gate | Gate (rising-edge / trigger). On the edge it seeks the playhead back to the START point (or 0 if there is no valid window) without changing play/pause state. gate / trigger; modulates cv_reset (summed directly (the destination DSP scales it)) |
cv_loop_toggle | gate | Gate (rising-edge / trigger). Each rising edge flips the transport between LOOP (jump to START at END) and ONE-SHOT (stop at END), the same state the LOOP button shows. gate / trigger; modulates cv_loop_toggle (summed directly (the destination DSP scales it)) |
asset_pitch | pitch | Pitch (raw V/oct passthrough, no cvScale). Selects which of 7 asset slots plays: pitch class C=slot1 D E F G A B=slot7 (octave-independent); a black-key class selects no slot. Read on each ASSET GATE rising edge. V/oct pitch CV; modulates asset_pitch (summed directly (the destination DSP scales it)) |
asset_gate | gate | Gate (rising-edge / trigger). On the edge it reads ASSET PITCH, maps it to a slot, and if that slot holds a loaded video makes it the active source — jumping the output to that slot's live virtual position (re-triggering the already-active slot restarts it from the window start). Empty or out-of-key selections are ignored. gate / trigger; modulates asset_gate (summed directly (the destination DSP scales it)) |
speedCv | cv | CV (bipolar -1..+1, modulates Speed). Sums into the SPEED knob position before the varispeed map, so +-1 sweeps the full reverse-to-forward span centred on the knob setting. control voltage (CV); modulates speedCv (additive offset — ±1 CV sweeps the full range, centered on the knob) |
startCv | cv | CV (bipolar -1..+1, modulates Start). Sums into the START slider only while patched (unpatched normals to 0), shifting the window's start/reset point earlier or later. control voltage (CV); modulates startCv (additive offset — ±1 CV sweeps the full range, centered on the knob) |
endCv | cv | CV (bipolar -1..+1, modulates End). Sums into the END slider only while patched (unpatched normals to full duration); negative CV pulls the window's end point earlier. control voltage (CV); modulates endCv (additive offset — ±1 CV sweeps the full range, centered on the knob) |
outputs
| id | cable | what it does |
|---|---|---|
video | video | Video. The decoded clip at the current transport state (speed, scrub, window), aspect-preserved (letterbox/pillarbox) into the engine FBO; an idle dark gradient before a file loads. RGB video stream |
audio_l | audio | Audio (left). Left channel of the ACTIVE slot's audio, tapped from its media-element source; varispeed pitch/tempo-shifts it on forward play and it is muted during reverse. audio signal |
audio_r | audio | Audio (right). Right channel of the active slot's audio, following the same active slot as audio_l and re-pointed automatically when the asset slot switches. audio signal |
params
| id | label | range | default | curve |
|---|---|---|---|---|
speed | Speed | 0..1 | — | linear |
start | Start | 0..1 | — | linear |
end | End | 0..1 | — | linear |
speedCv | Speed CV | -1..1 | 0 | linear |
startCv | Start CV | -1..1 | 0 | linear |
endCv | End CV | -1..1 | 0 | linear |
cv_start | Start gate | 0..1 | 0 | linear |
cv_pause | Pause gate | 0..1 | 0 | linear |
cv_reset | Reset gate | 0..1 | 0 | linear |
cv_loop_toggle | Loop gate | 0..1 | 0 | linear |
asset_pitch | Asset pitch | -10..10 | 0 | linear |
asset_gate | Asset gate | 0..1 | 0 | linear |
controls
| control | what it does |
|---|---|
| Asset gate | Synthetic Asset-gate cache (0..1, default 0). Holds the asset_gate level the card edge-detects to trigger a slot switch; not shown on the card UI. |
| Asset pitch | Synthetic Asset-pitch cache (raw V/oct, default 0, range -10..10). Holds the raw asset_pitch value the card reads on each asset-gate edge to pick a slot; not shown on the card UI. |
| Loop gate | Synthetic Loop-gate cache (0..1, default 0). Holds the cv_loop_toggle gate level the card edge-detects to flip LOOP vs ONE-SHOT; not shown on the card UI. |
| Pause gate | Synthetic Pause-gate cache (0..1, default 0). Holds the cv_pause gate level the card edge-detects to toggle pause/unpause; not shown on the card UI. |
| Reset gate | Synthetic Reset-gate cache (0..1, default 0). Holds the cv_reset gate level the card edge-detects to seek to START; not shown on the card UI. |
| Start gate | Synthetic Start-gate cache (0..1, default 0). Holds the cv_start gate level the card polls and edge-detects to fire a window-start restart; not shown on the card UI. |
| End | End slider (0..1 of duration, default 1). The end of the playback window; if START passes END the window is empty and playback halts. Summed with End CV when patched (unpatched normals to full duration). |
| End CV | Cached End CV value (-1..+1, default 0). Holds the live bipolar sample from the endCv input, summed into the END slider only while patched; not a user-facing control. |
| Speed | Speed knob (0..1, default 0.5). Asymmetric varispeed: 0 = -4x reverse, 0.5 = +1x normal forward, 1 = +4x; readout shows the live multiplier. Summed with Speed CV. |
| Speed CV | Cached Speed CV value (-1..+1, default 0). Holds the live bipolar sample from the speedCv input, summed into the SPEED knob; not a user-facing control. |
| Start | Start slider (0..1 of duration, default 0). The play-from and reset-to point of the playback window. Summed with Start CV when patched. |
| Start CV | Cached Start CV value (-1..+1, default 0). Holds the live bipolar sample from the startCv input, summed into the START slider while patched; not a user-facing control. |
source
videovarispeed.ts on GitHub.