poscil
Prev | Orchestra Opcodes and Operators | Next

## poscil

poscil — High precision oscillator.

## Description

High precision oscillator.

## Syntax

    ares poscil aamp, acps, ifn [, iphs]

    ares poscil aamp, kcps, ifn [, iphs]

    ares poscil kamp, acps, ifn [, iphs]

    ares poscil kamp, kcps, ifn [, iphs]

    ires poscil kamp, kcps, ifn [, iphs]

    kres poscil kamp, kcps, ifn [, iphs]

## Initialization

ifn -- function table number

iphs (optional, default=0) -- initial phase (normalized table index 0-1)

## Performance

ares -- output signal

kamp, aamp -- the amplitude of the output signal.

kcps, acps -- the frequency of the output signal in cycles per second.

poscil (precise oscillator) is the same as oscili, but allows much more precise frequency control, especially when using long tables and low frequency values. It uses floating-point table indexing, instead of integer math, like oscil and oscili. It is only a bit slower than oscili.

Since Csound 4.22, poscil can accept also negative frequency values and use a-rate values both for amplitude and frequency. So both AM and FM are allowed using this opcode.

The opcode poscil3 is the same as poscil, but uses cubic interpolation.

## Examples

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

Example 372. Example of the poscil 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    No messages
    -odac           -iadc     -d     ;;;RT audio I/O
    ; For Non-realtime ouput leave only the line below:
    ; -o poscil.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

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

    ; Instrument #1 - a basic oscillator.
    instr 1
      kamp = 10000
      kcps = 440
      ifn = 1

      a1 poscil kamp, kcps, ifn
      out a1
    endin

    </CsInstruments>
    <CsScore>

    ; Table #1, a sine wave.
    f 1 0 16384 10 1

    ; Play Instrument #1 for 2 seconds.
    i 1 0 2
    e

    </CsScore>
    </CsoundSynthesizer>

## See Also

poscil3

## Credits

Author: Gabriel Maldonado
Italy
1998

Example written by Kevin Conder.

November 2002. Added a note about the changes to Csound version 4.22, thanks to Rasmus Ekman.

New in Csound version 3.52

Prev | Up | Next
portk | Home | poscil3