René Nyffenegger's collection of things on the web | |
René Nyffenegger on Oracle - Most wanted - Feedback
- Follow @renenyffenegger
|
tablei (Csound opcode) | ||
tablei is used to access the values stored in a function table.
ir tablei indx, ifn[, ixmode[, ixoff[, iwrap]]]
indx: index into values of table filled with ifn. The table requires an extended guard point.
ixmode: 0: indx is raw (1 .. size table), 1: indx is normalized (0 .. 1) Illustrative example
The following example tries to illustrate how tablei works.
The .sco file:
f1 0 17 7 ; Function table no 7, with 17 "slots" 0 4 ; 1st element is 0 1 4 ; 5th element in table is one, making 2nd elem: 0.25, 3rd: 0.5, 4th: 0.75 -0.5 4 ; 9th element in table is -0.5 0.5 4 ; 13th element in table is 0.5 -1 ; 17th element in table is -1 i1 0 2
The .sco file fills a function table with 17 floats.
The .orc file:
sr = 44100 kr = 4410 nchnls = 1 instr 1 kidx phasor 1 ; Phasor with one Hertz ksig tablei kidx, 1, 1 asig = ksig out asig*30000 endin
The .orc file is very simple: a phasor scans the values of the table once in a second (The cps [hertz] parameter is set to one). With
tablei the values in the table are accessed. As we use tablei (rather than table), the values returned by tablei are interpolated. This
is why we get smooth edges rather than stair-shaped lines.
The values returned by tablei are in the range -1 .. 1, so they are multiplied with 30000 and outputted.
Finally, we need to make visible the amplitude of the signal:
Instruments
This opcode is used for the following instruments:
Other Csound opcodes.
|