pow
Prev | Orchestra Opcodes and Operators | Next

## pow

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

## Description

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

## Syntax

    ares pow aarg, kpow [, inorm]

    ires pow iarg, ipow [, inorm]

    kres pow karg, kpow [, inorm]

## Initialization

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!

## Performance

aarg, iarg, karg -- the base.

ipow, kpow -- the exponent.

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

## Examples

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

Example 582. Example of the pow opcode.

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

    <CsoundSynthesizer>
    <CsOptions>
    ; 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
    </CsOptions>
    <CsInstruments>

    ; 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
    endin

    </CsInstruments>
    <CsScore>

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

    </CsScore>
    </CsoundSynthesizer>

Its output should include a line like this:

    instr 1:  i1 = 4096.000

## Credits

Author: Paris Smaragdis
MIT, Cambridge
1995

Example written by Kevin Conder.

Prev | Up | Next
poscil | Home | powershape