wgpluck

Name

wgpluck --  A high fidelity simulation of a plucked string.

Description

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

Syntax

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

Initialization

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 idamp1, 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.

Performance

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.

Examples

The following example produces a moderately long note with rapidly decaying upper partials. It uses the files wgpluck.orc and wgpluck.sco.

Example 15-1. An example of the wgpluck opcode.

/* wgpluck.orc */
; Initialize the global variables.
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1

; Instrument #1.
instr 1
  icps = 220
  iamp = 20000
  kpick = 0.5
  iplk = 0
  idamp = 10
  ifilt = 1000

  axcite oscil 1, 1, 1
  apluck wgpluck icps, iamp, kpick, iplk, idamp, ifilt, axcite

  out apluck
endin
/* wgpluck.orc */
        
/* wgpluck.sco */
; Table #1, a sine wave.
f 1 0 16384 10 1

; Play Instrument #1 for two seconds.
i 1 0 2
e
/* wgpluck.sco */
        

The following example produces a shorter, brighter note. It uses the files wgpluck_brighter.orc and wgpluck_brighter.sco.

Example 15-2. An example of the wgpluck opcode with a shorter, brighter note.

/* wgpluck_brighter.orc */
; Initialize the global variables.
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1

; Instrument #1.
instr 1
  icps = 220
  iamp = 20000
  kpick = 0.5
  iplk = 0
  idamp = 30
  ifilt = 10

  axcite oscil 1, 1, 1
  apluck wgpluck icps, iamp, kpick, iplk, idamp, ifilt, axcite

  out apluck
endin
/* wgpluck_brighter.orc */
        
/* wgpluck_brighter.sco */
; Table #1, a sine wave.
f 1 0 16384 10 1

; Play Instrument #1 for two seconds.
i 1 0 2
e
/* wgpluck_brighter.sco */