readscratch

readscratch — returns a value stored in the instance of an instrument.

Description

The readscratch opcode returns one of four scalar values stored in the instance of an instrument.

Syntax

ival readscratch[index]

Initialisation

ival -- variable for result.

index -- which value to read, defaulting to zero.

Examples

Here is an example of the readscratch opcode. Play readscratch.csd

Example 891. Example of the readscratch 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
-n
</CsOptions>
<CsInstruments>

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

instr 1

ilast readscratch
      writescratch p2
ilen  readscratch 1
      writescratch p3, 1
      printf_i "last run at %f for %f\n", ilen, ilast, ilen
endin

</CsInstruments>
<CsScore>
i 1 0 1
i 1 2 3
i 1 6 10
e
</CsScore>
</CsoundSynthesizer>


See Also

writescratch,

Credits

Author: John ffitch
March 2013

New in Csound version 6.00