Skip to content

scphasor

A resettable linear ramp between two levels (renamed as trigphasor).

Plugin opcode in scugens.

Port of Supercollider's Phasor. DEPRECATED (renamed as trigphasor, )

Syntax

aindex = scphasor(xtrig, xrate, kstart, kend [, kresetPos])
kindex = scphasor(xtrig, xrate, kstart, kend [, kresetPos])
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 _kstart_if 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 scphasor opcode. It uses the file scphasor.csd.

Example of the scphasor opcode.
<CsoundSynthesizer>
<CsOptions>
  -o dac
</CsOptions>
<CsInstruments>

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

instr 1
  rate:k = linseg(1, p3, 40)
  trig:k = metro(rate)
  x:k = scphasor(trig, rate/kr, 0, 1)
  sine:a = oscili(0.2, x*500+500)
  outch(1, sine)
endin

instr 2
  rate:k = linseg(1, p3, 40)
  trig:a = mpulse(1, 1/rate)
  x:a = scphasor(trig, rate/sr, 0, 1)
  sine:a = oscili(0.2, x*500 + 500)
  outch(2, sine)
endin

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

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

Example of the sc_phasor opcode.
<CsoundSynthesizer>
<CsOptions>
  -o dac
</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