maketable

Create a table to hold values for use by an instrument or directly in a script.


Synopsis

table = maketable(“table_type”, [“optional specifiers”,] table_size, arg1[, arg2, … ])

Parameters inside the [brackets] are optional.


Description

maketable can be used for direct RTcmix Instrument envelope, waveform and other control purposes. It returns a table “handle” which can be stored in a scorefile variable. This “table-handle” can generally operate like other RTcmix scorefile variables, i.e., it can be treated arithmetically, a single table can control multiple aspects of an Instrument (without the annoyance of maintaining the correct makegen “table slot number”), and the syntax of the maketable command is fairly transparent for understanding how a particular table is employed in Instrument control.

maketable was introduced in RTcmix version 4.0, and you may encounter some very old scores that use the outdated makegen system. Many RTcmix instruments maintain backwards-compatibility with this older system, but support for the use of makegen constructs was dropped several years ago.


Arguments


Table Types


Examples

ampenv = maketable("line", 1000, 0,0, 1,1

The ampenv table-handle variable will reference a table containing a straight line from 0 to 1; the table will have 1000 elements.

wave = maketable("wave", "nonorm", 2000, 0.5)

The wave table-handle variable will reference a table containing a sine wave at half amplitude, ranging from -0.5 to 0.5. The “nonorm” optional specifier prevents the table from being normalized (scaled to fall between -1 and 1). The table will have 2000 elements.

The following score shows how the table-handle can be used arithmetically to operate upon other parameters in an instrument (in this case the WAVETABLE instrument):

env = maketable("line", 1000, 0,0, 1,1, 3,1, 4,0)
penv = maketable("line", 1000, 0,1, 1,1, 2,2, 3,2, 8,.15)
vib = maketable("wave3", "nonorm", 1000, 4.0*10, 4, 0)
pan = maketable("line", 100, 0,0, 1,1, 2,0.5)
wavt = maketable("wave", 4000, 1, 0.5, 0.3, 0.2, 0.1, 0.1)

WAVETABLE(0, 4.0, 20000 * env, (440.0 * penv) + vib, pan, wavt)

NOTES

The table-handle variables can be re-used during score parsing, i.e.

for (st = 0; st < 10; st = st+1) {
   amp = maketable("curve", 1000, 0, 0, -2.0,  2.5, 1, 1.4, 3.5, 0)
   wave = maketable("wave", 1000, random(), random(), random())
   WAVETABLE(st, 3.5, 10000 * amp, irand(100.0, 1000.0), random(), wave)
}

See Also

makeconnection, makemonitor, modtable, makefilter, makeconverter, tablelen, copytable, samptable, dumptable, plottable, mul, div, sub, add