pow — Computes one argument to the power of another argument.


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


ares pow aarg, kpow [, inorm]
ires pow iarg, ipow [, inorm]
kres pow karg, kpow [, inorm]


inorm (optional, default=1) -- 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!


aarg, iarg, karg -- the base.

ipow, kpow -- the exponent.

[Note] Note

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


Here is an example of the pow opcode. It uses the file pow.csd.

Example 335. Example of the pow opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

; Select audio/midi flags here according to platform
; Audio out   Audio in
-odac           -iadc    ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o pow.wav -W ;;; for file output any platform

; Initialize the global variables.
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1

; Instrument #1.
instr 1
  ; This could also be expressed as: i1 = 2 ^ 12
  i1 pow 2, 12

  print i1


; Play Instrument #1 for one second.
i 1 0 1


Its output should include a line like this:

instr 1:  i1 = 4096.000


Author: Paris Smaragdis
MIT, Cambridge

Example written by Kevin Conder.