wgpluck
Prev | Orchestra Opcodes and Operators | Next

## wgpluck

wgpluck — A high fidelity simulation of a plucked string.

## Description

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

## Syntax

    ares 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 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.

## 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 file wgpluck.csd.

Example 1139. An example of the wgpluck opcode.

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

    <CsoundSynthesizer>
    <CsOptions>
    ; Select audio/midi flags here according to platform
    ; Audio out   Audio in    No messages
    -odac           -iadc     -d     ;;;RT audio I/O
    ; For Non-realtime ouput leave only the line below:
    ; -o wgpluck.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

    ; 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

    </CsInstruments>
    <CsScore>

    ; Table #1, a sine wave.
    f 1 0 16384 10 1

    ; Play Instrument #1 for two seconds.
    i 1 0 2
    e

    </CsScore>
    </CsoundSynthesizer>

The following example produces a shorter, brighter note. It uses the file wgpluck_brighter.csd.

Example 1140. An example of the wgpluck opcode with a shorter, brighter note.

    <CsoundSynthesizer>
    <CsOptions>
    ; Select audio/midi flags here according to platform
    ; Audio out   Audio in    No messages
    -odac           -iadc     -d     ;;;RT audio I/O
    ; For Non-realtime ouput leave only the line below:
    ; -o wgpluck_brighter.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

    ; 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

    </CsInstruments>
    <CsScore>

    ; Table #1, a sine wave.
    f 1 0 16384 10 1

    ; Play Instrument #1 for two seconds.
    i 1 0 2
    e

    </CsScore>
    </CsoundSynthesizer>

## Credits

Author: Michael A. Casey
M.I.T.
Cambridge, Mass.
1997

New in Version 3.47

Prev | Up | Next
wgflute | Home | wgpluck2