repluck
Prev | Orchestra Opcodes and Operators | Next

## repluck

repluck — Physical model of the plucked string.

## Description

repluck is an implementation of the physical model of the plucked string. A user can control the pluck point, the pickup point, the filter, and an additional audio signal, axcite. axcite is used to excite the 'string'. Based on the Karplus-Strong algorithm.

## Syntax

    ares repluck iplk, kamp, icps, kpick, krefl, axcite

## 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).

## Performance

axcite -- A signal which excites the string.

## Examples

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

Example 891. Example of the repluck 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
    -odac   ;;;realtime audio out
    ;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
    ; For Non-realtime ouput leave only the line below:
    ; -o repluck.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

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

    instr 1

    iplk  = 0.75
    kamp  = .8
    icps  = 110
    krefl = p4
    kpick = p5

    axcite oscil 1, 1, 1
    asig repluck iplk, kamp, icps, kpick, krefl, axcite
    asig dcblock2 asig		;get rid of DC offset
         outs asig, asig

    endin
    </CsInstruments>
    <CsScore>
    f 1 0 16384 10 1	;sine wave.

    s
    i 1 0 1 0.95 0.75	;sounds heavier (=p5)
    i 1 + 1  <
    i 1 + 1  <
    i 1 + 1  <
    i 1 + 10 0.6

    s
    i 1 0 1 0.95 0.15	;sounds softer (=p5)
    i 1 + 1  <
    i 1 + 1  <
    i 1 + 1  <
    i 1 + 10 0.6
    e
    </CsScore>
    </CsoundSynthesizer>

Here is another example of the repluck opcode. It uses the file repluck-advanced.csd.

Example 892. Advanced example of the repluck 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
    -odac   ;;;realtime audio out
    ;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
    ; For Non-realtime ouput leave only the line below:
    ; -o repluck_advanced.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

    ; By Stefano Cucchi 2020

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

    instr 1

    iplk  = p4
    kamp  = p5
    icps  = p6

    krefll randomi 0.52, 0.99, 0.61
    kpickl randomi 0.1, 0.9, 13

    kreflr = p7
    kpickr = p8

    ain1 diskin "fox.wav", 1, 0

    asigl repluck iplk, kamp, icps, kpickl, krefll, ain1
    asigl dcblock2 asigl

    asigr repluck iplk, kamp, icps, kpickr, kreflr, ain1
    asigr dcblock2 asigr

    kdeclick linseg 0, 0.05, 1, p3-0.1, 1, 0.05, 0

    outch 1, asigl * kdeclick
    outch 2, asigr * kdeclick
    endin

    </CsInstruments>
    <CsScore>

    i 1 0 4 0.11 0.5 69 0.9 0.11
    i 1 3 4 0.11 0.5 12 0.9 0.11
    i 1 6 4 0.41 0.5 1 0.2 0.11
    i 1 9 4 0.11 0.5 300 0.9 0.99
    i 1 12 4 0.11 0.5 182 0.9 0.99
    i 1 15 15 0.99 0.5 12.039 0.9 0.11

    e
    </CsScore>
    </CsoundSynthesizer>

## See Also

wgpluck2

## Credits

Author: John ffitch
University of Bath/Codemist Ltd.
Bath, UK
1997

New in version 3.47

Prev | Up | Next
remove | Home | reshapearray