copya2ftab — Copy data from a vector to an f-table.


The copya2ftab opcode takes a k-array and copies the contents to an f-table.


copya2ftab kArray[], ktab [, koffset]
copya2ftab iArray[], itab [, ioffset]


kArray[] -- one-dimensional array for source.

ktab -- f-table for destination.

koffset -- offset into the f-table (defaults to 0).


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

Example 162. Example of the copya2ftab opcode.

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

; Select audio/midi flags here according to platform

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

;an 'empty' function table with 10 points
giTable ftgen   0, 0, -10, 2, 0

  instr 1

;print inital values of giTable
        puts    "\nInitial table content:", 1
indx    =       0
  until indx == ftlen(giTable) do
iVal    table   indx, giTable
        printf_i "Table index %d = %f\n", 1, indx, iVal
indx += 1

;create array
kArr[]  init    10

;fill in values
kArr    genarray 1, 10

;print array values
        printf  "%s", 1, "\nArray content:\n"
kndx    =       0
  until kndx == lenarray(kArr) do
        printf  "kArr[%d] = %f\n", kndx+1, kndx, kArr[kndx]
kndx    +=      1

;copy array values to table
        copya2ftab kArr, giTable

;print modified values of giTable
        printf  "%s", 1, "\nModified table content after copya2ftab:\n"
kndx    =       0
  until kndx == ftlen(giTable) do
kVal    table   kndx, giTable
        printf  "Table index %d = %f\n", kndx+1, kndx, kVal
kndx += 1

;turn instrument off
i 1 0 0.1

See also

Array opcodes


Author: John ffitch
October 2011

New in Csound version 5.15

Renamed in Csound version 6.00

Offset added in version 6.14