René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

f (Csound opcode)

f  tbl_no   tim   siz   gen  [p5 [p6...]]
Generates a function table.
tbl_no: The number of the table that is to be filled. This number will be used when referencing the table such as for example in tablei.
tim: The time when the table is to be filled.
siz: Number of points in the table. Must be a power of two or a power of two plus one (either 2n or 2n+1).
gen: On of the generation numbers. See below....

Function table gen routines

A negative value will cause rescaling to be omitted.

2

Transfers data from immediate pfields into a function table.

f2 is, together with f17 a routine that generates tables from numeric values.

A positive 2 (p4 field) causes the table to be post-normalized (rescaled to a maximum absolute value of 1 after generation). A negative 2 (-2) will cause rescaling to be skipped.

f1 0 8 2     0 0   1 1 1  -1 -0.5 -1

i1 0 1 30000 6.00 
sr     = 44100
kr     = 4410
nchnls = 1

instr 1
  iamp =        p4
  ifrq = cpsoct(p5)

  asig  oscil iamp, ifrq, 1

  out          asig
endin
This produces the following output:

/csound/opcodes/f2.jpg

4

Generates a normalizing function by examining the contents of an existing table.
f  #  time  size  4  source#  sourcemode   
source#: is the table to be examinded.
sourcemode: 0: scan from left to right; <>0: scan begins in mid

5

Construct a function table from segments of exponential curves
f#    time    size   5   a   n1   b   n2   c  .  .  .  

7

Constructs a function table from segments of straight lines.
f#    time    size   7   a   n1   b   n2   c  .  .  .
  • square:
    f1 0 256 7 -1 128 -1 0 1 128 1
  • sawtooth:
    f1 0 256 7 1 256 -1
  • triangle: f1 0 256 7 -1 128 1 128 -1
These wave forms can also be genearated with the vco opcode.

8

Generates a piecewise cubic spline curve, the smoothest possible through all specified points.
sr     = 44100
kr     = 4410
nchnls = 1

instr 1

  aidx phasor 1;  One Hertz 
  asig tablei aidx, 1, 1

  out asig * 30000
endin
f1   0   2048   8     -1     512    1   512    0.7    512    0.2    512   -1

i1   0  1
This orc file together with the sco file will produce the following output:
/csound/opcodes/f8.jpg

9

f   #    time    size   9      pna    stra   phsa   pnb   strb   phsb . . .  

10

Generates a function table whose values are construed like str1 * sin(x) + str2 * sin(2*x) + str3 * sin(3*x)
f   #    time    size  10      str1   str2   str3   str4 . . . .  
strn: Strengths of partials.

The gen10 routine can be used to create a sine. This is the case if there are no overtones (ie if str1 <> 0 and str2, str3 ... = 0)

13

Generates a table as a sum of Chebychev polynoms which can be used as a transfer function for waveshaping.
f4 can then be used to generate a normalizing function for the transfer function generated with f13.

17

f17 is, together with f2 a routine that generates tables from numeric values.

19

f   #    time    size  19      pna    stra   phsa   dcoa  pnb    strb  phsb  dcob  .  .  .  

20

Usually used for the grain opcode.