Karplus-Strong Texture Generator — User Guide

An extended Karplus-Strong texture instrument with a fractional-delay feedback resonator at the voice level and a separate event scheduler for repeated plucks, Poisson streams, strums, cascades, drones, and spatial textures.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 0.4.2 (2026) License: MIT License Repo: Praat AudioTools
Contents:

What this does

The generator has two independent levels:

Level 1 — resonator: every event is synthesized by an extended Karplus-Strong feedback loop with a short random excitation buffer, damping, a brightness-dependent loss filter, and a separate fractional-delay interpolator.

Level 2 — texture scheduler: the script decides when KS events occur, what pitches they use, how long their modeled tails are allowed to ring, and how the events are mixed and spatialized.

This distinction matters: Texture mode does not change the basic feedback algorithm. It changes the schedule of individual KS voices. Conversely, Damping, Brightness, and Excitation fill change each resonator even when the event schedule stays the same.

The implementation is Karplus-Strong / digital-waveguide-like rather than a complete physical model of a string. It does not simulate string stiffness and dispersion, body resonances, pickup position, bridge nonlinearity, or instrument radiation.

Quick start

  1. Run Karplus-Strong_Texture_Generator.praat. No input Sound is required.
  2. Choose Custom or one of the nine presets.
  3. For Custom, set Duration, Sample rate, Base pitch, Texture mode, Damping, Brightness, Excitation fill, and Spatial mode.
  4. Open Edit texture details for event rate, voice count, pitch span/jitter, strum span, tail cap, stereo detune, micro-delay, and Random seed.
  5. Leave Peak protection on if you want only excessive peaks reduced to 0.92. This is not normalization.

Important: a non-Custom preset overrides the relevant main-form and advanced values after the form is submitted. The exact overrides are listed below.

The Karplus-Strong voice

Each event starts with a short white-noise section inside the initial delay buffer. After that excitation, the Sound is generated recursively from earlier samples. The loop combines two simple filters:

B(z) = (1 - S) + S z^-1
S = 0.5 × (1 - Brightness)

F(z) = (1 - r) + r z^-1

B(z) controls brightness loss. At Brightness = 0, S = 0.5, giving the classic two-point averaging behavior. At Brightness = 1, S = 0, so that additional averaging loss disappears.

F(z) is an independent linear fractional-delay interpolator. Cascading the two filters gives a compact three-tap recurrence:

y[n] = Damping × (
       a0 y[n-N]
     + a1 y[n-N-1]
     + a2 y[n-N-2])

a0 = (1-S)(1-r)
a1 = (1-S)r + S(1-r)
a2 = Sr

Pitch calculation

The script does not simply round Fs / pitch. It estimates the low-frequency phase delay contributed by the brightness filter and puts the remaining fractional delay into the interpolator:

N + r + S ≈ Fs / requestedPitch

This substantially reduces the pitch change that would otherwise occur when Brightness changes. It is still an approximate low-frequency tuning compensation, not an exact physical-string tuning law at every frequency.

Excitation fill

Excitation fill controls how much of the initial delay buffer contains random excitation. A value of 1.0 is closest to the classic fully randomized initial buffer. Smaller values excite only the first part of the buffer and leave the remainder initially at zero.

This parameter is deliberately described as buffer fill, not literal pluck position: the implementation does not model the spatial position at which a real string is plucked.

Main controls

ControlRange / defaultMeaning
PresetCustom + 9 presetsSelects either manual control or a complete mechanism-oriented setup.
Durationdefault 6 s; max 120 sExact final Sound duration. Event tails are clipped at the end of this duration.
Sample rate8–192 kHz; default 44.1 kHzDirect synthesis and final output sample rate.
Base pitchminimum 20 Hz; default 220 HzReference pitch used directly or as the center of the texture's pitch distribution.
Texture mode6 modesControls event scheduling; it does not replace the KS resonator.
Damping0–1, exclusive; default 0.996Round-trip feedback multiplier. Values closer to 1 give slower decay. The script requires Damping < 1.
Brightness0–1; default 0.35Controls the extra averaging loss in the loop. Lower values suppress high-frequency loop energy more strongly.
Excitation fill>0–1; default 1.0Fraction of the initial delay buffer filled with white-noise excitation.
Spatial mode4 modesMono, event spread, correlated detuned pair, or micro-delay stereo.
Peak protectionon by defaultDown-only peak reduction to 0.92 when necessary.

Texture modes

1. Single Pluck

One KS event starts at time 0 at exactly the Base pitch. Pitch span, pitch jitter, event rate, and voice count do not affect the schedule.

2. Regular Re-plucks

Events begin at time 0 and repeat at exactly 1 / Event rate. Each event receives independent pitch jitter and a small random weight variation.

3. Poisson Pluck Stream

Inter-onset intervals are exponentially distributed:

IOI = -ln(U) / EventRate

The first event therefore does not have to occur at time 0. Each event receives a random pitch across half the requested Pitch span above or below Base pitch, plus the separate cents-scale Pitch jitter.

4. Strummed Cluster

Voice/event count notes are spread across the Strum span. Their pitches move from half the Pitch span below Base pitch to half the span above it, with independent pitch jitter.

In v0.4.2 the effective strum span is:

actualStrumSpan = min(StrumSpan, Duration)

so no strummed onset is scheduled after the end of the Sound. This also keeps event-tail and overlap calculations valid for short Custom durations.

5. Ascending Cascade

Voice/event count events rise through the requested Pitch span. The cascade duration is derived from Event rate but is limited to 78% of the complete Sound, and the event weights increase gradually through the cascade.

6. Re-excited Drone

Repeated KS excitations begin at time 0 and continue at the requested Event rate. Each event remains near Base pitch with independent cents-scale pitch jitter. With a long Damping time, the overlapping decays create the sustained texture.

Event-count safety

Version 0.4.1 replaced the former silent 64-event truncation. Regular Re-plucks, Poisson Pluck Stream, and Re-excited Drone can now schedule up to 5000 events. If a requested Custom schedule would exceed that safety limit, the script stops with an explicit message instead of silently shortening the texture.

Texture / spatial details

ControlDefaultUse
Event rate2.0 events/sRegular Re-plucks, Poisson Pluck Stream, Ascending Cascade timing, and Re-excited Drone.
Voice/event count7Number of events in Strummed Cluster and Ascending Cascade.
Pitch span12 semitonesPitch range for Poisson, Strummed Cluster, and Ascending Cascade.
Pitch jitter4 centsIndependent random pitch offset used by every multi-event texture.
Strum span180 msTotal onset spread of Strummed Cluster, capped by Duration in v0.4.2.
Maximum event tail6 sUpper bound on each modeled KS event tail.
Stereo detune7 centsPitch offset of the right member in Stereo Detuned Pair.
Micro-delay8 msRight-channel delay in Stereo Micro-Delay.
Random seed00 = unpredictable; a positive seed reproduces stochastic schedules, pitch/weight variations, and excitation noise for the same settings.

Tail estimation and overlap compensation

For every scheduled pitch, the script predicts the round-trip loop gain at the fundamental and converts that to an approximate T60. The event tail is then:

min(
  time remaining in the Sound,
  Maximum event tail,
  1.05 × predicted fundamental T60
)

A minimum rendered tail of 0.20 s is used when enough output duration remains. Mixing gain is then compensated from the actual scheduled mean overlap:

meanOverlap = sum(event tails) / Duration
eventMixGain = 0.72 / sqrt(max(1, meanOverlap))

This is an overlap-dependent gain heuristic, not loudness normalization.

Pitch headroom

The script limits the highest possible scheduled fundamental to 0.20 × Sample rate. Version 0.4.1 corrected this validation so it follows the actual scheduler:

This is a conservative validity check for the KS delay model. It should not be read as a statement that the output contains no spectral energy above 0.20 × Fs; a plucked-noise feedback loop naturally contains broadband and modal energy up to the digital Nyquist limit.

Presets

Non-Custom presets override the listed controls. Controls not listed retain their advanced defaults or the user's unaffected output options.

PresetMain overridesScheduler / spatial overrides
Canonical Single Pluck4 s; 220 Hz; Single Pluck; Damping .996; Brightness 0; Fill 1.0Mono; max tail 4 s
Warm Re-pluck Stream10 s; 110 Hz; Regular Re-plucks; Damping .995; Brightness .35; Fill .901.8 events/s; jitter 5 cents; Stereo Event Spread; max tail 4.5 s
Ascending String Cascade9 s; 220 Hz; Ascending Cascade; Damping .9975; Brightness .28; Fill 1.010 events; span 19 st; 1.5 events/s; jitter 2 cents; Stereo Event Spread; max tail 5 s
Long Metallic Pluck6 s; 330 Hz; Single Pluck; Damping .9993; Brightness .84; Fill .70Mono; max tail 6 s
Re-excited Low Drone14 s; 130 Hz; Re-excited Drone; Damping .9982; Brightness .32; Fill .85.72 events/s; jitter 2.5 cents; Stereo Detuned Pair; detune 3.5 cents; max tail 7 s
Bright Short Pluck3 s; 294 Hz; Single Pluck; Damping .990; Brightness .92; Fill .75Mono; max tail 3 s
Detuned Shimmer Pair8 s; 392 Hz; Single Pluck; Damping .9985; Brightness .42; Fill 1.0Stereo Detuned Pair; detune 8.6 cents; max tail 8 s
Prepared Detuned Cluster8 s; 185 Hz; Strummed Cluster; Damping .994; Brightness .55; Fill .628 events; span 9 st; strum 260 ms; jitter 8 cents; Stereo Event Spread; max tail 5 s
Sparse Resonant Cloud18 s; 261 Hz; Poisson Pluck Stream; Damping .9997; Brightness .22; Fill 1.0.42 events/s; span 7 st; jitter 14 cents; Stereo Micro-Delay; 11 ms delay; max tail 8 s

Presets do not override Sample rate, Random seed, Peak protection, Draw visualization, or Play result unless explicitly listed in the script's preset block.

Spatial modes

ModeImplementation
MonoAll scheduled KS voices are summed into one channel.
Stereo Event SpreadEvents are distributed from pan 0.05 to 0.95 by event index using equal-power gains sqrt(1-pan) and sqrt(pan). A single event is centered.
Stereo Detuned PairEach event creates two KS resonators. The right pitch is offset by Stereo detune cents. Both resonators use the same random excitation buffer, so the pair begins from correlated excitation rather than unrelated noise.
Stereo Micro-DelayThe original mono KS voice feeds the left channel immediately and the right channel after the requested delay. It does not recursively delay an already modified stereo channel.

Mono creates a one-channel output. All three spatial modes create stereo. In Stereo Micro-Delay, the final Sound still has exactly the requested Duration, so a delayed right-channel tail that would extend beyond the end is truncated by the output boundary.

Output and level

PropertyBehavior
InputNo selected Sound is required.
DurationExactly the requested Duration.
Sample rateExactly the selected 8–192 kHz rate.
ChannelsMono for Mono spatial mode; stereo otherwise.
Voice edgeEach individual KS voice receives only a very short cosine taper at its final edge: at most 8 ms or 10% of that voice's rendered tail.
Peak protectionIf enabled and the final mixed peak is above 0.92, Scale peak: 0.92 is applied once.
NormalizationNo unconditional normalization. Signals at or below 0.92 retain their generated level.
Object nameKS_Texture_<preset name>; spaces are replaced by underscores.

Visualization and QC

The Picture display is mechanism-focused and uses the actual schedule and measured output.

PanelWhat it shows
A — Actual Texture ScheduleEvery scheduled event as onset + rendered tail at its actual fundamental pitch. Pitch is displayed on a logarithmic vertical coordinate.
B — Feedback LoopTheoretical round-trip loop gain in dB/pass for the first event, including Damping, Brightness filter, and fractional-delay interpolator. Harmonic positions of the first event are overlaid as guides.
C — First Event DecayMeasured short-window RMS decay of the rendered first KS event compared with theoretical fundamental and fifth-partial decay slopes.
D — Texture → MeasurementMeasured spectrogram of the final output with actual event-fundamental guides.

For stereo output, Panel D analyzes whichever complete output channel has the higher RMS. Panel C uses a saved copy of the first rendered KS voice before it is mixed into the texture.

The QC strip reports the first event's integer delay N, fractional delay, brightness-filter delay S, three loop coefficients, predicted fundamental/fifth decay, fundamental T60, actual event count, mean overlap, overlap compensation gain, seed, pre/final peak, final RMS, synthesis time, and whether down-only peak protection was applied.

Further reading

These are the two directly relevant foundational sources cited by the script: