Use Non-Frames Version Previous Page Next Page
Mathematical Functions: Opcode Equivalents of Functions

pow

  ir      pow        iarg, ipow
  kr      pow        karg, kpow[, inorm]
  ar      pow        aarg, kpow[, inorm]

Description

Computes xarg to the power of kpow (or ipow) and scales the result by inorm.

Initialization

inorm – The number to divide the result (default to 1). This is especially useful if you are doing powers of a- or k- signals where samples out of range are extremely common!

iarg – i-rate base.

ipow – i-rate exponent

Performance

karg – k-rate base.

kpow – k-rate exponent

aarg – a-rate base.

Examples

  i2t2    pow        2,2      ; Computes 2^2.
  kline   line       0, 1, 4
  kexp    pow        kline, 2, 4

This feeds a linear function to pow and scales that to the line's peak value. The output will be an exponential curve with the same range as the input line.

  iamp    pow        0, 2
  a1      oscil      iamp, 100, 1
  a2      pow        a1, 2, iamp
          out        a2

This will output a sine with its negative part folded over the amplitude axis. The peak value will be iamp = 10^2 = 100.

The first line could also be written:

  i2t2    =  2^2

Use ^ with caution in arithmetical statements, as the precedence may not be correct. New in Csound version 3.493.

Deprecated Names

pow was originally three opcodes called ipow, kpow, and apow. As of Csound version 3.48 those names are deprecated, and the three seperate opcodes replaced by pow.

Author

Paris Smaragdis
MIT, Cambridge
1995


Use Non-Frames Version Previous Page Next Page
Mathematical Functions: Opcode Equivalents of Functions