Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Utilities

Source of truth: the doc comments on each module struct in patches-modules/src/ define the canonical port names, parameter ranges, and behaviour. This page is kept in sync with those comments.

Glide — Portamento / pitch smoothing

Smooths a stepped input signal toward its target using a one-pole low-pass filter. Because V/oct is a log-frequency scale, linear interpolation in V/oct space gives a perceptually constant-ratio (equal-interval) glide.

Parameters

ParameterTypeDefaultDescription
glide_msfloat (ms)100.0Glide time in milliseconds (0–10000)
slur_amountfloat1.0Multiplier applied to glide_ms while slur_in is high (0–100)

Inputs

PortDescription
inInput signal (typically V/oct)
slur_inGate: when high, glide time is multiplied by slur_amount

Outputs

PortDescription
outSmoothed output

Tuner — Pitch offset

Transposes a V/oct signal by a fixed interval expressed as octaves, semitones, and cents. All three parameters are additive:

out = in + octave + semi/12 + cent/1200

Setting all parameters to zero passes the signal through unchanged.

Parameters

ParameterTypeDefaultDescription
octaveint0Octave shift (−8 to +8)
semiint0Semitone shift (−12 to +12)
centint0Fine-tune in cents (−100 to +100; 100 cents = 1 semitone)

Inputs

PortDescription
inV/oct input

Outputs

PortDescription
outTransposed V/oct

Sah — Sample and hold

Latches the in signal on each rising edge of trig (threshold 0.5) and holds the sampled value on out until the next trigger. The held value is initialised to 0.0 before the first trigger.

Inputs

PortDescription
inSignal to sample
trigTrigger input; latch fires on the ≥ 0.5 rising edge

Outputs

PortDescription
outHeld output value

PolySah — Polyphonic sample and hold

Polyphonic variant of Sah. A single mono trig latches all 16 voice channels simultaneously on each rising edge (threshold 0.5).

Inputs

PortDescription
inPolyphonic signal to sample (16 voices)
trigMono trigger; all voices are latched together

Outputs

PortDescription
outPolyphonic held output (16 voices)

Quant — V/oct quantiser

Snaps a continuous V/oct signal to the nearest pitch in a user-supplied set. The scale is declared via channels (an alias list or count), with one pitch[i] parameter per scale degree. Each pitch is a V/oct value reduced modulo 1.0 into [0.0, 1.0), giving an octave-invariant pitch class. The quantiser is not restricted to 12-tone equal temperament: any microtonal or non-Western scale can be declared by supplying the desired V/oct fractions directly. The formula applied before quantisation is:

quantised_input = centre + in × scale

Emits a one-sample pulse on trig_out whenever the quantised pitch changes.

Example

module quant : Quant(channels: [root, third, fifth]) {
    pitch[root]:  C0,
    pitch[third]: Eb0,
    pitch[fifth]: G0
}

Parameters

ParameterTypeDefaultDescription
pitch[i]float (V/oct)0.0Target pitch per scale degree (i in 0..N−1, N = channels)
centrefloat (V/oct)0.0DC offset added to the input before quantisation (−4 to +4)
scalefloat1.0Gain applied to in before quantisation (−4 to +4)

Inputs

PortDescription
inContinuous V/oct input

Outputs

PortDescription
outQuantised V/oct output
trig_outOne-sample pulse (1.0) on each pitch change, otherwise 0.0

PolyQuant — Polyphonic V/oct quantiser

Applies the same quantisation logic as Quant independently to each of the 16 polyphonic voices. All voices share the same pitch[i], centre, and scale parameters. Each voice has its own trig_out channel that fires independently when that voice’s quantised pitch changes.

Parameters

ParameterTypeDefaultDescription
pitch[i]float (V/oct)0.0Target pitch per scale degree (i in 0..N−1, N = channels)
centrefloat (V/oct)0.0DC offset added to each voice before quantisation (−4 to +4)
scalefloat1.0Gain applied to each voice before quantisation (−4 to +4)

Inputs

PortDescription
inPolyphonic V/oct input (16 voices)

Outputs

PortDescription
outPolyphonic quantised V/oct output (16 voices)
trig_outPer-voice one-sample pulse on pitch change (16 voices)

RingMod — Diode ring modulator

Analog diode-bridge ring modulator model (Julian Parker, DAFx-11). Produces sum and difference frequencies. The drive parameter sets the operating point on the diode I–V curve: low drive is near-ideal multiplication; higher drive introduces harmonic colouring.

Parameters

ParameterTypeDefaultDescription
drivefloat (dB)1.0Diode operating point in dB (0.2–20.0); low = linear, high = saturated

Inputs

PortDescription
signalAudio signal to modulate
carrierCarrier / modulator signal

Outputs

PortDescription
outRing-modulated output