← All modules

@maru shared this instrument so you can build on it and use it in your DAW.

AvailableInstrument

Pluck

A physical string model, rendered per note.

About

A plucked string, modelled rather than sampled. Each note is a pick striking a virtual string that rings, loses its brightness and fades the way a real one does, from nylon guitar and harp to koto, bass and buzzing sitar wire.

The idea

Pluck uses extended Karplus-Strong synthesis: a short burst of energy, the pick, sent into a delay line one period of the note long, with filters in the loop for loss and stiffness. Because the sound comes from a model of the string, every control is a physical property rather than an effect added afterwards. Pluck position is not an EQ, damping is not a fade, and stiffness is not a detune.

Pluck position shows this best. Where you pluck decides which harmonics can exist at all: pluck a fifth of the way along and the 5th, 10th and 15th harmonics are not quieter, they are gone. The panel plots that pattern from the same maths the string uses.

Low notes behave differently from high ones, as on a real instrument. A bass string is thick for its length, so Stiffness stretches its partials audibly at the bottom of the keyboard and barely at all at the top, and low strings lose more of their upper partials on every trip along the string.

Controls

  • Hardness is the pick: a hard plectrum gives a sharp, bright attack, a soft fingertip a rounder one. Playing harder also makes the note brighter, not just louder.
  • Pick Noise adds the scrape of a nail or pick.
  • Position is where along the string you pluck, from near the bridge to the middle.
  • Brightness sets where the string starts losing its upper partials, and Damping how strongly. Together they decide how quickly the tone darkens as it rings.
  • Stiffness stretches the partials, from a soft gut string to wire.
  • Sustain is how long the string rings, up to eight seconds.
  • Body adds the resonance of an instrument body.
  • Width spreads the sound across the stereo field, and Level sets the output.

Each note takes its settings at the moment it is plucked, as a real string does: changing a control affects the next notes, not the ones already ringing. Pluck plays up to twelve notes at once.

Getting started

Play Pluck from your computer keyboard or a MIDI controller. Start with Nylon, then try Steel, Harp, Koto, Muted or Bass. Glass Harp plucks dead centre, so every even harmonic disappears, and Sitar Wire turns Stiffness all the way up until the partials buzz.

How it works.

A pluck is an excitation entering a tuned feedback loop. The excitation is a raised-cosine pick pulse whose width comes from Hardness, a hard plectrum leaves in a few samples and is broadband, a fingertip stays in contact for a fraction of a period and rolls off early, blended with one-pole-filtered noise for the nail. Velocity shifts the effective hardness rather than only the gain, so a loud note is genuinely brighter. The noise is drawn from a seeded xorshift forked per consumer, never Math.random, which is what makes a note reproducible.

Pluck position is applied to that excitation as a delay-and-subtract: exc[n] − exc[n − d], with d the pluck point's share of one period, rounded to samples. Its magnitude response is 2·|sin(π·k·position)| at harmonic k, so every harmonic with a node at the pluck point is exactly zero rather than merely attenuated. The rounding to whole samples is negligible on a long loop and worth a couple of percent of the length on a short one, so the realised position drifts from the knob at the top of the keyboard, the panel draws the realised one. The maths and the plot both come from ui-kit's pluck-position library, which is pinned against a DFT of that filter rather than against a restatement of its own algebra.

The loop is a fractional delay line, a one-pole low-pass for loss, and a first-order allpass with a negative coefficient for stiffness. Both filters add delay of their own, a one-pole contributes a/(1−a) samples, the allpass (1−c)/(1+c), and a loop that ignored that would play flat by over a dozen samples on a dark, stiff, low patch, which is a quarter tone at 55 Hz. So the delay line is given the period minus what the filters contribute and the remainder rides on the interpolator. At the very top of the range the filters can want more delay than the note has, and stiffness is given up first: being in tune is not negotiable.

Loop gain is solved, not dialled. exp(−6.9078 / (f · T60)) puts the fundamental exactly 60 dB down after the Sustain time, and the renderer then allocates exactly that long plus a 20 ms raised-cosine fade onto true zero. A tail is therefore never truncated mid-ring and a buffer never holds seconds of silence, the note is as long as the physics says and not one sample longer.

Renders are cached per note, per velocity layer, per strike variant, and per timbre-parameter hash. Velocity is quantised into four layers because it changes the excitation's spectrum but not its level, level is a gain at playback, so it stays continuous. Repeated strikes of one key alternate between two seeds, which is the cheap and correct fix for the machine-gun artefact a single buffer would have. Moving any timbre parameter drops the whole cache, because those parameters change the samples themselves. The cache is bounded by total frames rather than by entry count: a Muted patch's buffers are a fifth of a second and a Harp's are five, so an entry cap would mean a different memory ceiling on every patch.

Voices are capped at twelve with oldest-first stealing. Re-plucking a ringing note stops the old one over 60 ms, one string has one vibration, which is the opposite of the Gamelan module where a bar struck twice really is two strikes ringing together. Key-up damps over a time that scales with the patch's own sustain, between 120 and 900 ms, so a Muted patch stops when you let go and a Harp patch is allowed the moment of ring a harpist would get.

What would you make with Pluck?

Describe what you want to make. Build it with the Studio agent.

Goes well with.

Prototype

A compact subtractive synth for learning the signal path.

Prototype

Modelled bronze instruments with flexible tuning.

Prototype

Convolution reverb: eight synthesized spaces, twenty-five real cabinets.