René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback
 

Panning in CSound

In order to create a panning effect, a function table is created (using f.. 5 that contains a triangle. This triangle is read during the performance and the output is adjusted according to the value of the triangle.
f1  0 1024 7  .5 256 1 512 0 256 0.5
f2 0 2048 10 1

i1  0.00  -0.25 10000 7.00
i1  0.25  -0.25 10000 7.03
i1  0.50  -0.25 10000 7.05
i1  0.75  -0.25 10000 7.03
i1  1.00  -0.25 10000 7.00
i1  1.25  -0.25 10000 7.03
i1  1.50  -0.25 10000 7.05
i1  1.75   0.25 10000 7.03
sr     = 44100
kr     = 4410
nchnls = 2


instr 1

  ilen  init abs(p3)
  iamp  init p4
  ifrq  init cpspch(p5)

  kenv  linen  iamp, 0.02, ilen, 0.04

  tigoto  tied_note

  kpan oscili 1, 0.5, 1

tied_note:

  asig oscili kenv, ifrq, 2 

  outs asig * kpan, asig * (1-kpan)

endin