sample & hold

sampleHold · utility · schema v1

Sample & 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.

Two classic CV tools in one: a sample & hold AND a scale quantizer. Each rising edge at the GATE input grabs the current value at the CV input and holds it steady until the next edge — the staircase-random / random-arpeggio trick when you feed it noise or an LFO and clock it. The QUANT output additionally snaps that held value to the nearest note of the selected musical scale (1V/oct, root = C at 0V, 12-ET semitones per octave). When NOTHING is patched to GATE the module stops holding and instead passes CV through continuously — so QUANT becomes a live, free-running scale quantizer for any incoming pitch CV. The card shows the active scale name above the knob and a S&H / QUANTIZER hint reflecting whether the gate is patched. The sample/hold + quantize math runs in a DSP worklet.

the faceplate

sample & holdcv_incvgate_ingatecv_outcvcv_quantcvaudiocvgatepitch
2 inputs · 2 outputs · 1 params

inputs

idcablewhat it does
cv_incvThe 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_ingateThe 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

idcablewhat it does
cv_outcvThe 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_quantcvThe 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

idlabelrangedefaultcurve
scaleScale0..?1discrete

controls

controlwhat it does
ScaleSelects 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.

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