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

foscili (Csound opcode)

Basic frequency modulated oscillator with linear interpolation
ar foscili xamp, kcps, xcar, xmod, kndx, ifn [, iphs]
xamp: amplitude of the output signal
kcps: (fundamental [perceived]) frequency of the output signal
xcar: kcps * xcar = carrier frequency
xmod: xmod * kcps = modulating frequency (freq_mod)
kndx: modulation index: kndx * kcps * xmod = kndx * freq_mod= modulation amplitude
foscili.orc
sr     = 44100
kr     =  4410
nchnls =     1

instr 1
  ilen = p3
  iamp = p4
  ifrq = p5

  icar = p6
  imod = p7
  indx = p8

  kenv     linseg 1, ilen, 0
  asig     foscili iamp, ifrq, icar, imod, indx, 1

  out a_out * kenv
endin
foscili.sco
f1 0 2048 10 1

;                  xcar    xmod   kndx
;------------------------------------------
i1 0 1   10000 100 1       2.8    6.0;   Bell
i1 + 1   10000 100 1       2.8    <
i1 + 1   10000 100 1       2.8    <
i1 + 1   10000 100 1       2.8    3.0

i1 + 1   10000 250 1       0.7    1.5;   Bass Clarinet
i1 + 1   10000 250 1       0.7    <
i1 + 1   10000 250 1       0.7    <
i1 + 1   10000 250 1       0.7    0.1

i1 + 1   10000 700 1       1.0    5.0;   Trumpet
i1 + 1   10000 700 1       1.0    <
i1 + 1   10000 700 1       1.0    <
i1 + 1   10000 700 1       1.0    0.1

i1 + 1   10000 500 1       1.0    10 ;   FM
i1 + 1   10000 500 1       <      <
i1 + 1   10000 500 1       <      <
i1 + 1   10000 500 1       10     10
BTW, fm synthesis shows how to generate signals without foscili but with two oscilators (oscili).
See also foscil, oscil and oscili.

Instruments

This opcode is used for the following instruments: