sc_phasor
Prev | Orchestra Opcodes and Operators | Next

## sc_phasor

sc_phasor — A resettable linear ramp between two levels

## Description

Plugin opcode in scugens.

A resettable linear ramp between two levels. Port of Supercollider's Phasor.

## Syntax

    aindex sc_phasor xtrig, xrate, kstart, kend [, kresetPos]

    kindex sc_phasor xtrig, xrate, kstart, kend [, kresetPos]

## Performance

Phasor is a linear ramp between kstart and kend values. When its trigger input crosses from non-positive to positive, sc_phasor's output will jump to its reset position (or to kstartif no reset value was given). Upon reaching the end of its ramp, sc_phasor will wrap back to its start.

If kresetPos is specified, this value will be used to jump to after a trigger. Otherwise, a trigger will set the position back to kstart

If one wants Phasor to output a signal with frequency freq oscillating between start and end, then the rate should be:

(end - start) * freq / sr

## Examples

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

Example 878. Example of the sc_phasor opcode.

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

    <CsoundSynthesizer>
    <CsOptions>
    </CsOptions>
    <CsInstruments>

    sr = 44100
    ksmps = 128
    nchnls = 2
    0dbfs = 1.0

    instr 1
    	krate linseg 1, p3, 40
    	ktrig metro krate
    	kx sc_phasor ktrig, krate/kr, 0, 1
    	asine oscili 0.2, kx*500+500
    	outch 1, asine
    endin

    instr 2
    	krate linseg 1, p3, 40
    	atrig = mpulse(1, 1/krate)
    	ax sc_phasor atrig, krate/sr, 0, 1
    	asine oscili 0.2, ax*500+500
    	outch 2, asine
    endin

    </CsInstruments>
    <CsScore>
    i1 0 20
    i2 0 20
    </CsScore>
    </CsoundSynthesizer>

## See also

phasor

## Credits

By: Eduardo Moguillansky 2017

Prev | Up | Next
sc_lagud | Home | sc_trig