Use Non-Frames Version Previous Page Next Page
Mathematical Operations: Mathematical Functions

powoftwo, logbtwo


          powoftwo(x)  (init-rate or control-rate args only)

          logbtwo(x)   (init-rate or control-rate args only)


Description

Power-of-two operations.

Performance

powoftwo() function returns 2 ^ x and allows positive and negatives numbers as argument. The range of values admitted in powoftwo() is -5 to +5 allowing a precision more fine than one cent in a range of ten octaves. If a greater range of values is required, use the slower opcode pow.

logbtwo() returns the logarithm base two of x. The range of values admitted as argument is .25 to 4 (i.e. from -2 octave to +2 octave response). This function is the inverse of powoftwo().

These functions are fast, because they read values stored in tables. Also they are very useful when working with tuning ratios. They work at i- and k-rate.

Authors

Gabriel Maldonado
Italy
June, 1998

John ffitch
University of Bath, Codemist, Ltd.
Bath, UK
July, 1999
New in Csound version 3.57


Use Non-Frames Version Previous Page Next Page
Mathematical Operations: Mathematical Functions