Skip to content

wgpluck2

Physical model of the plucked string.

It has control over the pluck point, the pickup point and the filter. Based on the Karplus-Strong algorithm.

Syntax

ares wgpluck2 iplk, kamp, icps, kpick, krefl

Initialization

iplk -- The point of pluck is iplk, which is a fraction of the way up the string (0 to 1). A pluck point of zero means no initial pluck.

icps -- The string plays at icps pitch.

Performance

kamp -- Amplitude of note.

kpick -- Proportion of the way along the string to sample the output.

krefl -- the coefficient of reflection, indicating the lossiness and the rate of decay. It must be strictly between 0 and 1 (it will complain about both 0 and 1).

Examples

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

Example of the wgpluck2 opcode.
<CsoundSynthesizer>
<CsOptions>
; 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 wgpluck2.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

; by Menno Knevel 2021

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

instr 1

iplk = p4
kamp = .7
icps = 220
kpick = 0.75
krefl = p5

apluck wgpluck2 iplk, kamp, icps, kpick, krefl
apluck  dcblock2    apluck
outs apluck, apluck

endin

</CsInstruments>
<CsScore>
;         pluck   reflection
i 1 0 1     0       0.9
i 1 + 1     <       .
i 1 + 1     <       .
i 1 + 1     1       . 

i 1 5 5     .75     0.7 
i 1 + 5     .05     0.7 
e
</CsScore>
</CsoundSynthesizer>

See also

Waveguide Physical Modeling

Credits

Author: John ffitch (after Perry Cook)
University of Bath, Codemist Ltd.
Bath, UK

New in Csound version 3.47