Skip to content

strset

Allows a string to be linked with a numeric value.

Syntax

strset iarg, istring

Initialization

iarg -- the numeric value.

istring -- the alphanumeric string (in double-quotes).

strset (optional) allows a string, such as a filename, to be linked with a numeric value. Its use is optional.

Examples

The following statement, used in the orchestra header, will allow the numeric value 10 to be substituted anywhere the soundfile asound.wav is called for.

strset 10, "asound.wav"

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

Example of the strset opcode.
<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
; Audio out   Audio in    No messages
-odac           -iadc     -d     ;;;RT audio I/O
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 1
nchnls = 1

;Example by Andres Cabrera 2008

; \\n is used to denote "new line" 
strset 1, "String 1\\n"
strset 2, "String 2\\n"

instr 1
Str strget p4
prints Str
endin


</CsInstruments>
<CsScore>
;        p4 is used to select string
i 1 0 1  1
i 1 3 1  2
</CsScore>
</CsoundSynthesizer>

See Also

String Manipulation Opcodes

Orchestra Header Statements