vincr
Prev | Orchestra Opcodes and Operators | Next

## vincr

vincr — Accumulates audio signals.

## Description

vincr increments one audio variable with another signal, i.e. it accumulates output.

## Syntax

    vincr accum, aincr

## Performance

accum -- audio-rate accumulator variable to be incremented

aincr -- incrementing signal

vincr (variable increment) and clear are intended to be used together. vincr stores the result of the sum of two audio variables into the first variable itself (which is intended to be used as an accumulator in polyphony). The accumulator is typically a global variable that is used to combine signals from several sources (different instruments or instrument instances) for further processing (for example, via a global effect that reads the accumulator) or for outputting the combined signal by some means other than one of the out opcodes (eg. via the fout opcode). After the accumulator is used, the accumulator variable should be set to zero by means of the clear opcode (or it will explode).

## Examples

The following example uses the vincr opcode. It uses the file vincr.csd.

Example 905. Example of the vincr 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 RT audio input is needed too
    ; For Non-realtime ouput leave only the line below:
    ; -o vincr.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

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

    gaReverb init 0

    instr 1

    idur	= p3
    kpitch	= p4
    a1	diskin2	"fox.wav", kpitch
    a1	= a1*.5			;reduce volume
    	vincr	gaReverb, a1
    endin

    instr 99 ; global reverb
    al, ar	reverbsc gaReverb, gaReverb, .8, 10000
    	outs	gaReverb+al, gaReverb+ar

    clear	gaReverb

    endin

    </CsInstruments>
    <CsScore>

    i1  0 3 1
    i99 0 5
    e

    </CsScore>
    </CsoundSynthesizer>

This is another example uses the vincr opcode. It uses the file vincr-complex.csd.

Example 906.

    <CsoundSynthesizer>
    <CsOptions>
    ; Select audio/midi flags here according to platform
    -odac     ;;;realtime audio out
    ;-iadc    ;;;uncomment -iadc if RT audio input is needed too
    ; For Non-realtime ouput leave only the line below:
    ; -o vincr-complex.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

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

    gaReverbSend init 0

    instr 1

    iamp   = p4
    ifreq  = p5
    aenv   linseg  0.0, 0.1*p3, iamp, 0.6*p3, iamp, 0.3*p3, 0.0
    aosc   poscil aenv, ifreq, 1
           vincr   gaReverbSend, aosc
    endin

    instr 2	; global reverb instrument

    al, ar reverbsc gaReverbSend, gaReverbSend, 0.85, 12000
           outs     gaReverbSend+al, gaReverbSend+ar
           clear    gaReverbSend
    endin

    </CsInstruments>
    <CsScore>
    f1 0 4096 10 1

    { 4 CNT
      { 8 PARTIAL
          ;   start time     duration            amplitude          frequency
          i1  [0.5 * $CNT.]  [1 + ($CNT * 0.2)]  [.04 + (~ * .02)]  [800 + (200 * $CNT.) + ($PARTIAL. * 20)]
      }
    }

    i2 0 6
    e
    </CsScore>
    </CsoundSynthesizer>

## See Also

clear

## Credits

Author: Gabriel Maldonado
Italy
1999

New in Csound version 3.56

Prev | Up | Next
vibrato | Home | vlimit