The Alternative Csound Reference Manual
Previous |  | Next

# oscils

oscils -- A simple, fast sine oscillator

## Description

Simple, fast sine oscillator, that uses only one multiply, and two add operations to generate one sample of output, and does not require a function table.

## Syntax

ar oscils iamp, icps, iphs [, iflg]

## Initialization

iamp -- output amplitude.

icps -- frequency in Hz (may be zero or negative, however the absolute value must be less than sr/2).

iphs -- start phase between 0 and 1.

iflg -- sum of the following values:

- 2: use double precision even if Csound was compiled to use floats. This improves quality (especially in the case of long performance time), but may be up to twice as slow.

- 1: skip initialization.

## Performance

ar -- audio output

## Examples

Here is an example of the oscils opcode. It uses the files oscils.orc and oscils.sco.

Example 1. Example of the oscils opcode.

    /* oscils.orc */
    ; Initialize the global variables.
    sr = 44100
    kr = 4410
    ksmps = 10
    nchnls = 1

    ; Instrument #1 - a fast sine oscillator.
    instr 1
      iamp = 10000
      icps = 440
      iphs = 0

      a1 oscils iamp, icps, iphs
      out a1
    endin
    /* oscils.orc */

    /* oscils.sco */
    ; Play Instrument #1 for 2 seconds.
    i 1 0 2
    e
    /* oscils.sco */

## Credits

Author: Istvan Varga
January 2002

Example written by Kevin Conder.

New in version 4.18

Previous | Home | Next
osciln | Up | oscilx