<info>
ESM Csound Library
MONO orc: marimba   sco: marimba3
A very rapid stereo lick illustrating (in the score11 file
that created the Csound score) use of the score11 keywords
sets and movex to determine rhythm, durations (duty factor),
pitch (p4), amplitude (p5), attack time (p6), attack 
hardness (p7) , brightness (p8) and stereo location (p10).
and neutral values for amplitude (p5), attack time (p6),
attack hardness (p7) and brightness (p8).
Duration: 8.01 seconds
Allan Schindler  1/97
</info>
<tk_interface>


</tk_interface>
<mono>
    
; ### Eastman Orchestra Library Instrument  m_a_r_i_m_b_a ###
; Function Needed: 100                                               
; p fields:
; p6 attack time (c. .01-.04)
; p7 attack hardness(1. ord; range .75-1.5)                         
; p8 brightness (1. ord; range: .25-1.5)
; - - - - - - - -
instr 30
	; Set defaults:
	p6 = (p6 = 0 ? .025 : p6) ; attack time
	p7 = (p7 = 0 ? 1. : p7) ; attack hardness
	p8 = (p8 = 0 ? 1. : p8) ; brightness
	
p4 = (p4>0?p4:(abs(p4))/100)  ; for microtones; -800.050 = quarter tone above c
i1 = (p4<13.01? cpspch(p4):p4)
        ;  --- Detuning  module (mostly for use with "chorus" ) ---
  idetunepf = p9
if idetunepf = 0 goto detunedone ;skip all this if detuning set to 0 in score
       idtcount init 0  ; counter
       idtmult =  (idetunepf > 0 ? 1.05946 : .94387) ;1/2 step freqency ratios
  idetune init 1.  ; detuning multiplier for p4 pitch
        icheck = abs(idetunepf)
        icheck = int(icheck)

   dumbloop:
	      idtcount = idtcount + 1   ; increment counter
	      idtmult = (icheck = 0 ? 1 : idtmult)
	      idetune = idetune * idtmult 
   if idtcount < icheck igoto dumbloop
 ; microtonal detuning:
	idtmult = abs(idetunepf)
	idtmult = frac(idtmult)
	idtmult = idtmult * .05496
	idtmult = (idetunepf > 0 ? idtmult : - idtmult)
	idetune = idetune + idtmult
i1 = i1 * idetune 
detunedone:   ; ---end of detuning module -------
i2 = octcps(i1)
i99=1       
p5 = p5*i99
p7 = p7*i99
p8 = p8*i99
i3 = (16.25-i2)*.12                     ; scalar; ef3 = .96,ef3=1.08,ef5=.84
i4 = (i3+1)/2                           ;  scalar                          
p6 = p6*i3
i5 = ((12.15-i2)*.32*((p7+2)/3))+.12  ;duration & amplitude depend upon pitch
p5 = p5*((p7+1)/2)*(i3<1.?1.:i4)        ; & hardness of attack
i15 = p7*p8*i3          ; scalar based on pitch,attack hardness & brightness

p8 = (i2<11?p8:p8 - (abs(i2-13)*.1))    ; protection against bomb outs
a1 linseg 0,p6/p7,1,((2/(p7+1))*i4*.055)-p6,(3/(p7+2))*i4*.54,.1*i5,.27,.15*i5,i4*.15,.25*i5,i4*.1,(.5*i5)-.055,0,i5,0
a2 linseg 1,p3-.025,1,.025,0
a1 = a2*a1*p5
timout (i5 < p3? i5 : p3),p3,test
goto contin
test:  k2 rms a1
if k2 > 10 kgoto contin
 turnoff

; Random amplitude deviation
contin: k1 expseg p7*.2,p6,p7*.09,i2-p6,.06
k1 randi k1,39/p7
a1 =a1 + (k1*a1)             ; Total amplitude

;  ***  Attack Chiff ***
k2 expseg p7*p8*i4,((p7+1)/2)*(.77*p6),.002,p3,.001
k2 randi k2*.5,999           ; random frequency deviation

k3 expseg p7*p8*i3*2.2,p7*.8*p6,.001,p3,.001; envelope for fm index
; - - - - -
;   Frequencies and Envelopes of the Individual Partials 
if i2>7.75 igoto treble
; Frequencies of the partials

; 6 partials for low tones (a3 & below)
i6 = 4.03
i7 = 10.1
i8 = 17.9
i9 = 24.2*i1
i10 = 33.5*i1
i11= 42.9*i1
if i2 <6.75 igoto skip
i6 = i6-((i2-6.75)*.02)
i7 = i7-((i2-6.75)*.2)
i8 = i8-((i2-6.75)*1.)
skip: i6 = i6*i1
i7 = i7*i1
i8 = i8*i1
i12 = 1+(.8*(i2-6.75))
i13 = 1+(.33*(i2-6.75))
i14 = 1+(.6*i12)
i15 = 7.85-i2

i16 = .14
i17 = .18
i18 = .17
i19 = .22
i20 = .06
i21 = .12
i22 = .05
i23 = .06
i24 = .02
igoto doit
; - - - midrange : 4 partials for tones between bf3 and a5
treble: if i2 > 9.75 igoto veryhi
if i2>8.75 goto higher
i6 = (4.01+(.03*(i2-7.75)))*i1          ; partial frequencies for a3-a4
i7 = (10. - (.9*(i2-7.75)))*i1
i8 = (16.9-(3.*(i2-7.75)))*i1
i12 = 1+((i2-7.75)*.2)
i13 = 1-((i2-7.75)*.12)
igoto skip2
higher: i6 = (4.04-(.74*(i2-8.75)))*i1  ; partial frequencies for a4-a5
i7 = (9.1-(2.7*(i2-8.75)))*i1
i8 = (13.9-(2.8*(i2-8.75)))*i1
i12 = 1+((9.75-i2)*.2)
i13 = .9
skip2:
i16 = .15
i17 = .13
i18 = .13
i19 = .09
i20 = .07
i21 = .04
igoto doit
; - - - - 3 partials for highest tones (bf5 and above)
veryhi:
i6 = (3.3-((i2-9.75)*.3))*i1
i6 = (i6<sr/2?i6:.75*(sr/2))      ; foldover protection
i7 = (6.4-((i2-9.75)*.7))*i1
i7 = (i7<sr/2?i7:.85*(sr/2))      ; foldover protection
i12 = 1
i13 = 1
i16 = .14
i17 = .14
i18 = .11
i19 = .09
; - - -

doit:                         
a2 expseg p8*i16,i3*i17*i5,p8*.005
a2 = i12*a2*a1
a1 = a1-a2
a2 oscili a2,i6+(k2*i6),100,.05                  ; partial 2

a3 expseg p8*i18,i5*i3*i19,p8*.004
a3 = i13*a3*a1
a1 = a1-a3
a3 oscili a3,i7+(k2*i7),100,.11                  ; partial 3
a2 = a2+a3
if i2>9.75 kgoto fos
a3 expseg i15*i20,i5*i15*i21,p8*.004
a3 = i14*a3*a1
a1 = a1-a3
a3 oscili a3,i8+(k2*i8),100,.15                  ; partial 4
a2 = a2+a3
if i2 > 7.75 kgoto fos
a3 expseg i15*i22,i5*i15*i23,p8*.003
a3 = i15*a3*a1
a1 = a1-a3
a3 oscili a3,i9+(k2*i9),100,.21                  ; partial 5
a2 = a2+a3
if i2 > 7.5 kgoto fos
a4 expseg i15*i24,i5*i15*i24,p8*.003
a4 = i15*a4*a1
a1 = a1-a4
a4 oscili a4,i10+(k2*i10),100,.24                ; partial 6
a2 = a2+a4

fos:  a1 foscili a1,i1+(k2*i1),1,((p7+i4)/2)*1.2,p7*p8*i3*k3,100
a1 = a1+a2

;Standard out statement
out a1
endin

</mono>
<stereo>


</stereo>
<quad>


</quad>
<score>
f100 0 1024 10 1.
  i30 0.000 0.241 7.091 10890 0.017 1.400 1.300 0 0.862
  i30 0.037 0.240 7.029 5840 0.015 1.185 0.452 0 0.671
  i30 0.074 0.215 9.06 3131 0.017 0.990 0.382 0 0.454
  i30 0.115 0.220 8.041 1679 0.017 0.812 0.305 0 0.412
  i30 0.153 0.217 9.00 808 0.014 0.723 0.252 0 0.333
  i30 0.193 0.233 7.099 1019 0.013 0.828 0.304 0 0.214
  i30 0.236 0.231 6.10 1044 0.017 0.814 0.313 0 0.241
  i30 0.275 0.232 7.101 1042 0.020 0.797 0.400 0 0.145
  i30 0.313 0.220 8.039 881 0.012 0.771 0.477 0 0.161
  i30 0.358 0.237 8.05 1024 0.015 0.771 0.391 0 0.180
  i30 0.397 0.220 7.089 1449 0.018 0.791 0.436 0 0.115
  i30 0.445 0.227 10.11 1312 0.012 0.818 0.498 0 0.056
  i30 0.483 0.217 7.031 1330 0.014 0.932 0.391 0 0.122
  i30 0.531 0.227 8.00 1538 0.018 0.989 0.500 0 0.208
  i30 0.573 0.235 7.091 2043 0.012 0.949 0.583 0 0.258
  i30 0.607 0.223 7.029 2454 0.012 1.026 0.634 0 0.119
  i30 0.645 0.238 9.06 2770 0.016 1.017 0.576 0 0.344
  i30 0.685 0.219 8.041 2658 0.018 1.045 0.652 0 0.374
  i30 0.731 0.225 9.00 3411 0.011 1.109 0.753 0 0.239
  i30 0.772 0.228 7.099 3967 0.011 1.131 0.773 0 0.334
  i30 0.815 0.222 9.04 4120 0.012 1.063 0.705 0 0.362
  i30 0.858 0.228 7.101 4948 0.018 1.158 0.802 0 0.455
  i30 0.906 0.220 8.039 5547 0.017 1.137 0.940 0 0.566
  i30 0.941 0.236 8.05 6038 0.012 1.177 0.882 0 0.663
  i30 0.978 0.224 9.069 6712 0.012 1.236 1.047 0 0.761
  i30 1.013 0.235 10.11 7927 0.018 1.239 1.062 0 0.753
  i30 1.055 0.221 7.031 8838 0.012 1.278 1.165 0 0.573
  i30 1.099 0.222 10.11 9866 0.014 1.313 1.223 0 0.404
  i30 1.137 0.227 6.111 11250 0.019 1.350 1.300 0 0.280
  i30 1.179 0.233 7.071 5829 0.016 1.198 0.975 0 0.191
  i30 1.223 0.223 10.09 3020 0.010 1.057 0.696 0 0.138
  i30 1.263 0.231 9.101 1564 0.019 0.924 0.456 0 0.096
  i30 1.306 0.227 9.03 836 0.016 0.849 0.255 0 0.066
  i30 1.342 0.225 9.078 978 0.012 0.960 0.235 0 0.198
  i30 1.388 0.233 7.00 959 0.018 0.919 0.353 0 0.120
  i30 1.425 0.235 8.011 941 0.011 0.885 0.264 0 0.088
  i30 1.463 0.232 8.061 981 0.019 0.810 0.378 0 0.100
  i30 1.503 0.228 9.00 1017 0.015 0.775 0.294 0 0.266
  i30 1.550 0.223 9.082 993 0.017 0.735 0.340 0 0.212
  i30 1.589 0.230 11.05 1048 0.018 0.840 0.416 0 0.248
  i30 1.637 0.227 9.018 1051 0.011 0.771 0.386 0 0.271
  i30 1.684 0.231 6.06 1076 0.018 0.907 0.436 0 0.148
  i30 1.726 0.231 6.111 1159 0.017 0.863 0.511 0 0.317
  i30 1.765 0.224 7.071 1274 0.014 0.836 0.497 0 0.382
  i30 1.810 0.225 10.09 1275 0.011 0.882 0.508 0 0.340
  i30 1.852 0.228 9.101 1127 0.012 0.972 0.469 0 0.423
  i30 1.896 0.227 9.03 1449 0.019 0.910 0.600 0 0.431
  i30 1.933 0.232 9.078 1344 0.010 1.005 0.641 0 0.589
  i30 1.981 0.225 7.05 1912 0.016 0.945 0.623 0 0.637
  i30 2.019 0.226 8.011 1955 0.011 1.025 0.643 0 0.692
  i30 2.061 0.232 8.061 2193 0.014 1.025 0.646 0 0.646
  i30 2.101 0.229 9.00 1939 0.018 1.033 0.767 0 0.754
  i30 2.146 0.227 9.082 2260 0.014 1.087 0.726 0 0.831
  i30 2.184 0.231 11.05 2235 0.012 1.082 0.764 0 0.887
  i30 2.230 0.226 8.059 2744 0.016 1.108 0.858 0 0.601
  i30 2.275 0.229 8.05 2637 0.019 1.104 0.874 0 0.358
  i30 2.319 0.229 6.111 3204 0.016 1.149 0.968 0 0.152
  i30 2.356 0.227 7.071 3446 0.012 1.177 0.990 0 0.010
  i30 2.402 0.230 10.09 3908 0.014 1.193 1.061 0 0.010
  i30 2.445 0.230 9.021 4149 0.013 1.221 1.072 0 0.010
  i30 2.491 0.229 9.03 4180 0.018 1.230 1.147 0 0.010
  i30 2.538 0.230 9.078 4875 0.019 1.258 1.192 0 0.010
  i30 2.584 0.228 9.07 4663 0.016 1.287 1.250 0 0.010
  i30 2.621 0.229 9.081 5370 0.017 1.307 1.317 0 0.010
  i30 2.656 0.229 9.011 5567 0.014 1.329 1.392 0 0.010
  i30 2.700 0.229 9.00 6389 0.012 1.350 1.450 0 0.010
  i30 2.737 0.605 9.082 6628 0.015 1.350 1.450 0 0.010
  i30 2.780 0.576 11.05 7571 0.015 1.350 1.450 0 0.010
  i30 2.819 0.637 8.059 7891 0.015 1.350 1.450 0 0.010
  i30 2.855 0.701 10.11 8426 0.016 1.350 1.450 0 0.010
  i30 2.901 0.748 9.081 9289 0.020 1.350 1.450 0 0.010
  i30 2.950 0.785 8.118 10102 0.017 1.350 1.450 0 0.010
  i30 2.985 0.853 10.09 10709 0.014 1.350 1.450 0 0.010
  i30 3.029 0.891 9.021 11647 0.011 1.350 1.450 0 0.010
e

</score>


