ftslicei

ftslicei — Copy a slice from an f-table to another f-table at init

Description

Plugin opcode in emugens.

The ftslicei opcode takes an f-table and copies a slice to a second f-table (similar to tab2array, but between tables). This action is done at init time. For a performance-time version, see ftslice

Syntax

ftslicei ifnsource, ifndest [, istart, iend, istep ]

Initialization

ifnsource -- The table number to copy data from

ifndest -- The table number to copy data to

istart -- The index to start copying from. Defaults to 0

iend -- The end index to stop copying. This is NOT inclusive. 0 means copy to the end of the table. Defaults to end of table

istep -- How many elements to skip. Defaults to 1

Performance

Examples

For an example, refer to the ftslice opcode: ftslice.csd.

Example 406. Example of the ftslice opcode.

<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>

; Example file ftslice

/*

ftslice: 

Copy slice from source table to destination table

Syntax:

ftslice ifnsource, ifndest, kstart=0, kend=0, kstep=1

ifnsource: source table
ifndest: destination table
kstart: the index to start copying from
kend: the end index to stop copying. This is NOT inclusive. 0=end of table
kstep: how many elements to skip

See also: tablecopy, tableicopy, tab2array
*/

instr 1
  ifn   ftgentmp 0, 0, -13, -2,  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
  idest ftgentmp 0, 0, -11, -2,  0   ; empty table of size 11

  ; copy only even elements
  ftslice ifn, idest, 0, 0, 2
  ftprint idest

  ; copy too many elements - only the elements which fit in the dest table
  ; are copyed

  ftslice ifn, idest
  ftprint idest  

  turnoff
endin


</CsInstruments>
<CsScore>
i 1 0   0.1

</CsScore>
</CsoundSynthesizer>


See also

Read/Write Operations

Credits

By: Eduardo Moguillansky 2018

New plugin in version 6.12