Skip to content

array

Converts an input into an array, optionally creating it.

The audio-input form remains supported. It copies each block of audio into a k-rate array with ksmps elements, creating the array if needed.

⚠ Deprecated initializers

Only the forms that initialize an array from a list of values are deprecated. Use fillarray for these. The audio-input form is not deprecated.

Syntax

kSamples[] = array(aSignal)

Legacy value-list forms

These forms take initial values and remain available for compatibility:

iValues[] = array(ival1, ival2, ...)
kValues[] = array(ival1, ival2, ...)

For new code, use fillarray:

iValues[] = fillarray(1, 2, 3)
kValues[] = fillarray(1, 2, 3)

Examples

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

Example of the array opcode.
<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
ksmps = 64
nchnls = 1
0dbfs = 1

instr 1
 Params:i[] = fillarray(p4, p5)
 Audio:k[] = array(oscili(Params[0],Params[1]))
 out a(Audio)
endin
schedule(1,0,2,0.5,440)
eventi("e",0,2)

</CsInstruments>
<CsScore>
</CsScore>
</CsoundSynthesizer>

See also

fillarray, array opcodes

Credits

Author: John ffitch, Victor Lazzarini
a-sig version introduced in version 7.