interleave

interleave — Interleaves arrays into a a single one by placing the input data in alternate positions.

Description

Takes input arrays, a and b and interleaves their data (placing values in alternating positions).

Syntax

kout[] interleave kin1[], kin2[]

Performance

kout[] -- output array containing the interleaved output. It will be created if it does not exist.

kin1[], kin2[] -- input arrays containing the values to be interleaved.

Examples

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

Example 479. Example of the interleave opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

<CsoundSynthesizer>
<CsOptions>
-n
</CsOptions>
<CsInstruments>


instr 1

kin1[] fillarray 1,2,3,4
kin2[] fillarray 5,6,7,8

kInt[] interleave kin1, kin2

printf "inputs: \n%d %d %d %d \n%d %d %d %d\n", 1,
         kin1[0], kin1[1], kin1[2], kin1[3],
         kin2[0], kin2[1], kin2[2], kin2[3]

printf "interleaved:\n%d %d %d %d %d %d %d %d\n", 1,
         kInt[0], kInt[1], kInt[2], kInt[3],
         kInt[4], kInt[5], kInt[6], kInt[7]
endin

</CsInstruments>
<CsScore>
i1 0 1	
e
</CsScore>
</CsoundSynthesizer>

See Also

Vectorial opcodes, array opcodes

Credits

Author: Victor Lazzarini
NUI Maynooth
2018

New in version 6.12