sample & hold
sampleHold · utility · schema v1Sample & hold combined with a musical scale quantizer. On a RISING EDGE at gate_in the module samples cv_in and HOLDS it on cv_out until the next rising edge; cv_quant is that held value snapped to the nearest note of the selected SCALE (1V/oct, root = C / 0V, 12 equal-tempered semitones per octave, 1/12 V per semitone). When NOTHING is patched to gate_in, cv_in passes through CONTINUOUSLY and cv_quant continuously quantizes the live input — so the module becomes a pure QUANTIZER (the gate-connected state is detected at the graph level, mirroring SEQUENCER/SCORE external-clock-vs-internal-BPM and SKIFREE's unpatched-input fallback). The SCALE knob picks the quantize scale from Chromatic, Major, Minor, Dorian, Phrygian, Lydian, Mixolydian, Locrian, Harmonic Minor, Melodic Minor; the current scale NAME is displayed above the knob and updates reactively (knob / CV / MIDI Learn). The latch + nearest-note quantizer are pure functions (packages/dsp/src/lib/sample-hold-dsp.ts) shared verbatim by the worklet, the unit tests, and node-ART. Classic uses: quantize a slow LFO/random voltage into stepped melodies, sample noise on a clock for stepped random pitches, or strip the gate to use it as an inline quantizer in front of a VCO's pitch input.
the faceplate
inputs
| id | cable | what it does |
|---|---|---|
cv_in | cv | The value to sample (when gated) or quantize (when ungated). Typically a noise source, LFO or random CV for the classic stepped-random effect, or a pitch CV when used as a pure quantizer. control voltage (CV) |
gate_in | gate | The sample clock: each rising edge latches the current cv_in and holds it on the outputs until the next rising edge. Leave it UNPATCHED and the module stops latching and passes cv_in through continuously — turning the module into a live quantizer. gate / trigger |
outputs
| id | cable | what it does |
|---|---|---|
cv_out | cv | The held value — cv_in captured at the last gate edge (or, with the gate unpatched, the live passed-through cv_in). This is the raw sample & hold output, NOT quantized. control voltage (CV) |
cv_quant | cv | The same held/live value snapped to the nearest note of the selected SCALE (1V/oct, C/0V root). Patch this to an oscillator's pitch input for in-key stepped melodies from random CV. control voltage (CV) |
params
| id | label | range | default | curve |
|---|---|---|---|---|
scale | Scale | 0..? | 1 | discrete |
controls
| control | what it does |
|---|---|
| Scale | Selects the quantize scale used by the QUANT output, as a stepped knob cycling through the built-in scales (e.g. Chromatic, Major, and other modes/scales); the active scale's NAME is shown above the knob. It affects only QUANT — the raw HOLD output is never quantized. Default Major. |
source
sample-hold.ts on GitHub.