wgpluck — A high fidelity simulation of a plucked string.


A high fidelity simulation of a plucked string, using interpolating delay-lines.


ares wgpluck icps, iamp, kpick, iplk, idamp, ifilt, axcite


icps -- frequency of plucked string

iamp -- amplitude of string pluck

iplk -- point along the string, where it is plucked, in the range of 0 to 1. 0 = no pluck

idamp -- damping of the note. This controls the overall decay of the string. The greater the value of idamp, the faster the decay. Negative values will cause an increase in output over time.

ifilt -- control the attenuation of the filter at the bridge. Higher values cause the higher harmonics to decay faster.


kpick -- proportion of the way along the point to sample the output.

axcite -- a signal which excites the string.

A string of frequency icps is plucked with amplitude iamp at point iplk. The decay of the virtual string is controlled by idamp and ifilt which simulate the bridge. The oscillation is sampled at the point kpick, and excited by the signal axcite.


Here is an example of the wgpluck opcode. It uses the file wgpluck.csd.

Example 1244. An example of the wgpluck opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

; Select audio/midi flags here according to platform
; Audio out   Audio in
-odac             ;;;RT audio out
; For Non-realtime ouput leave only the line below:
; -o wgpluck.wav -W ;;; for file output any platform

; by Menno Knevel 2021

sr = 44100
ksmps = 32
nchnls = 2
0dbfs  = 1

instr 1

icps = 220
iamp = 1
kpick = 0.5
iplk = 0
idamp = p4
ifilt = p5
ichoice = p6

if ichoice == 1 then
    axcite =    0                   ; no exciter signal
    axcite diskin2  "fox.wav", 1    ; use the fox as exciter
    axcite *=   .15                 ; but lower amplitude

apluck wgpluck icps, iamp, kpick, iplk, idamp, ifilt, axcite
apluck  dcblock2    apluck          ; gets rid of DC offset
outs apluck, apluck


f 1 0 16384 10 1        ; sine wave.
;          damp     filter  choice           
i 1 0 8     10      1000      1
i 1 + 8     30      10        1
i 1 0 8     10      1000      2
i 1 + 8     30      10        2

See also

Waveguide Physical Modeling


Author: Michael A. Casey
Cambridge, Mass.

New in Version 3.47