ephasor

ephasor — produces two outputs: a periodic phase signal and a periodic exponential decaying signal.

Description

This opcode produces two outputs: a periodic phase signal (like the phasor opcode), and a periodic exponential decaying signal. The latter is synchronised to the former, starting at 1 and then decreasing at the same time as the phase signal increases from 0 to 1. The rate of exponential decay can be controlled by the second parameter.

Syntax

aexp,aph ephasor kfreq, kR

Performance

kfreq - the rate at which the phase and exponential signals are generated

kR - a parameter controlling the decay rate of the exponential signal, 0 < kR < 1. Lower values produce faster decays.

Examples

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

Example 238. Example of the ephasor 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=64
nchnls=2
0dbfs = 1

instr 1

iamp = p4
ifr = p5
kfr expon ifr,p3,2*ifr

kfc expon 2000,p3, 4000
kq = 10
kbw = kfc/kq
kR = 1 - $M_PI*(kbw/sr)

k1 = kfc/kfr
kn = int(k1)
k1 = k1 - kn

amod,aph ephasor kfr,kR
aosc1 table aph*kn,-1,1,0,1
aosc2 table aph*(kn+1),-1,1,0,1

asig = iamp*(aosc1*(1 - k1) + aosc2*k1)*amod
  outs asig, asig
  
endin

</CsInstruments>
<CsScore>

i1 0 10 0.5 220

e
</CsScore>
</CsoundSynthesizer>

Credits

Author: Victor Lazzarini
2008

New in version 5.10