<info>
ECMC Csound Tutorial example
</info>ECMC Csound Tutorial example ex3-5
<tk_interface>

</tk_interface>
<mono>
; #############################################################
; soundfile ex3-5  : "Classical" FM with modulation index envelope : ECMC Csound Tutorial
; FM - single carrier, single modulator "classical fm" instrument 
; p3 = duration ; p4 = pitch (cps or pch); p5 = amplitude 
; p6 = attack time ; p7 = decay time ; p8 = atss amplitude multiplier 
; frequency modulation : p9 freq. ratio of modulator to carrier 
; fm index envelope values : p10 beginning; p11 after p6; p12 before p7 

   sr = 44100
   kr = 4410
   ksmps = 10
   nchnls = 1

instr 38
ipitch = ( p4 >  13.0 ? p4 : cpspch(p4) ) 
p8 = (p8 > 9.99 ? p8 : p8*p5) ; p8 can be an absolute value or * p5 
kamp expseg 1, p6, p5, p3-(p6+p7), p8, p7, 1 ; amplitude envelope 

kfmindex expseg p10, p6, p11, p3-(p6+p7), p12, p7, .3*p12 ; fm index envelope 

a1 foscili kamp, ipitch , 1, p9, kfmindex , 100 
out a1 
endin
</mono>

<stereo>
</stereo>
<quad>
</quad>
<score>
f100 0 1024 10 1.
  i38 0.000 4.000 7.03 10000 0.050 3.800 0.500 1.005 7.000 2.000 0.800
  i38 4.000 4.000 7.03 1500 1.000 0.200 7.000 1.996 0.100 0.400 4.500
  i38 8.000 4.000 7.03 10000 0.080 3.400 0.600 1.400 0.500 1.600 0.500
  i38 12.000 4.000 7.03 10000 0.050 3.600 0.400 2.700 8.000 3.500 0.800
e

</score>
