clear

clear — Zeroes a list of audio signals.

Description

clear zeroes a list of audio signals.

Syntax

clear avar1 [, avar2] [, avar3] [...]
clear avar[]

Performance

avar1, avar2, avar3, ... -- signals to be zeroed

avar[] -- array of signals to be cleared.

kvar[] ... -- array of k-values to be cleared.

[Note] Note
Before version 6.13 this opcode was not compatible with multicore operations if used with a global variable.

clear sets every sample of each of the given audio signals to zero when it is performed. This is equivalent to writing avarN = 0 in the orchestra for each of the specified variables. Typically, clear is used with global variables that combine multiple signals from different sources and change with each k-pass (performance loop) through all of the active instrument instances. After the final usage of such a variable and before the next k-pass, it is necessary to clear the variable so that it does not add the next cycle's signals to the previous result. clear is especially useful in combination with vincr (variable increment) and they are intended to be used together with file output opcodes such as fout.

Examples

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

Example 143. Example of the clear opcode.

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


See the fout opcode for another example.

See also

File Input and Output

Comparators and Accumulators

Credits

Author: Gabriel Maldonado
Italy
1999
Author: Victor Lazzarini

New in Csound version 3.56

Revised in Csound version 6.17 for arrays