<info>
i is ex6-4-1
ECMC Csound Tutorial example ex6-4-1
</info>
<tk_interface>
</tk_interface>
<mono>
;  #############################################################
;  orchestra file examples ex6-4-1, 6-4-2 and 6-4-3
; non-12 tone tuning examples
;  #############################################################

sr=44100
kr=2205
ksmps=20
nchnls=1


instr 1

icps  cps2pch  p4, p6
        ; convert pch to midi note number
        imidinote =  int((p4) - 3) * 12
        imidinote = int(imidinote + ((frac(p4) * (12/p6)) * 100))
; ------------------------------------------

  ; use function tables 99 & 98 to get closest multisample soundfile
ifno	table	imidinote, 99  ;keyboard mapping to gen1 function tables 
ibasno	table	ifno, 98        ; returns midi notes of the sonudfile samples
ibasoct	=	ibasno/12. + 3.
ibasepitch = cpsoct(ibasoct)
; ------------------------------------------
iendloop = 1 ; dummy end loop point for loscil
                       ; csound aborts without an end loop value, even
                       ; if no looping is specified

asig	loscil	1, icps , ifno, ibasepitch , 0, 0, iendloop
print icps, imidinote, ifno, ibasepitch
; ------------------------------------------
; AMPLITUDE SCALING and OPTIONAL NEW AMPLITUDE ENVELOPE
	iamp = p5
	irise = (p7 = 0? .0001 : p7)
	idec = (p8 = 0? .0001 : p8)
kamp expseg .005, irise, iamp, p3 - (irise + idec), iamp , idec, .005
asig = asig * kamp
; ------------------------------------------
out asig
endin
</mono>
<stereo>
</stereo>
<score>

                  SCORE-11, Version 1.4
Copyright (C) 1982, 1990, 1992, 1995 by Alexander R. Brinkman
     Eastman School of Music, University of Rochester

f1 0 262144 -1 "/sflib/string/vc.p.c2" 0 0 0 
f2 0 131072 -1 "/sflib/string/vc.p.e2" 0 0 0 
f3 0 131072 -1 "/sflib/string/vc.p.gs2" 0 0 0 
f4 0 131072 -1 "/sflib/string/vc.p.c3" 0 0 0 
f5 0 131072 -1 "/sflib/string/vc.p.e3" 0 0 0 
f6 0 65536 -1 "/sflib/string/vc.p.gs3" 0 0 0 
f7 0 131072 -1 "/sflib/string/vc.p.c4" 0 0 0 
f8 0 65536 -1 "/sflib/string/vc.p.e4" 0 0 0 
f9 0 65536 -1 "/sflib/string/vc.p.gs4" 0 0 0 
f10 0 65536 -1 "/sflib/string/vc.p.b4" 0 0 0 
f11 0 65536 -1 "/sflib/string/vc.p.d5" 0 0 0 
f99 0 128 -17 0 1 38 2 42 3 46 4 50 5 54 6 58 7 62 8 66 9 70 10 73 11 
f98 0 16 -2 0 36 40 44 48 52 56 60 64 68 71 74 
  i1 0.000 0.700 7.000 0.500 11 0 0.307
  i1 0.500 0.700 7.010 0.500 11 0 0.331
  i1 1.000 0.700 7.020 0.500 11 0 0.316
  i1 1.500 0.700 7.030 0.500 11 0 0.340
  i1 2.000 0.700 7.040 0.500 11 0 0.275
  i1 2.500 0.700 7.050 0.500 11 0 0.338
  i1 3.000 0.700 7.060 0.500 11 0 0.318
  i1 3.500 0.700 7.070 0.500 11 0 0.325
  i1 4.000 0.700 7.080 0.500 11 0 0.285
  i1 4.500 0.700 7.090 0.500 11 0 0.312
  i1 5.000 0.700 7.100 0.500 11 0 0.307
  i1 5.900 0.700 7.110 0.500 11 0 0.261
  i1 5.907 0.700 7.000 0.500 11 0 0.293
e
</score>
