an open-source digital signal processing and sound synthesis language
about · links · contact
div - divide a table associated with a table-handle by a constant or do a point-by-point division by another table-handle table.


div(table_handle1, table_handle2/constant)


div operates on each element of the function table referred to by table_handle1 by either dividing by the value constant to each one or by dividing each one by the corresponding element of the table associated with table_handle2. If the two tables are of different sizes, the values will be interpolated relative to the length of each table prior to the division. The interpolation scheme used depends upon the original setting of the optional specifier for interpolation used in the original maketable scorefile command that was used to create the table.

NOTE: The functionality of div has largely been duplicated by the pfield-enabled capabilities of RTcmix instruments. However, the div function is still useful for Perl and shell-script front-ends to RTcmix.


The table-handle identifier for the first table (the dividends to be used).

The table-handle identifier for the second table to be divided into the first (the divisors), or

the constant value that will be divided into to all the values of the first table


Returns a table-handle referring to the modified table. If the second value is ever 0, then the value 999999999999999999.9 is returned. Hey, it's almost infinity... right?


   table1 = maketable("literal", "nonorm", 5, 1.0, 2.0, 3.0, 4.0, 5.0)
   table2 = maketable("literal", "nonorm", 5, 2.0, 4.0, 5.0, 8.0, 10.0)
   newtable1 = div(table1, 2.0)
   newtable2 = div(table1, table2)

The table-handle newtable1 will be associated with a new table that will contain the following sequence of elements:

    0.5, 1.0, 1.5, 2.0, 2.5
and the elements of newtable2 will be:
    0.5, 0.5, 0.6, 0.5, 0.5

See Also

maketable, modtable, makefilter, makeconverter, tablelen, copytable, add, sub, mul