<info>
ESM Csound Library
orc: marimba   sco: marimba2
A "rolled tremolo" on a 4 note chord with
  1. cresc., then diminuendo (p5)
  2. increasing, then decreasing attack hardness (p7)
     & brightness (p8)
  Duration: 7.45 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.443 6.03 3583 0.014 0.706 0.373 0
  i30 0.087 0.462 7.10 4007 0.017 0.719 0.352 0
  i30 0.188 0.362 6.11 3956 0.016 0.741 0.432 0
  i30 0.269 0.379 8.05 3980 0.014 0.753 0.390 0
  i30 0.346 0.423 6.03 3941 0.014 0.768 0.465 0
  i30 0.438 0.373 7.10 4283 0.014 0.785 0.487 0
  i30 0.518 0.344 6.11 4030 0.019 0.793 0.458 0
  i30 0.586 0.428 8.05 4300 0.018 0.809 0.521 0
  i30 0.678 0.426 6.03 4113 0.013 0.829 0.565 0
  i30 0.776 0.364 7.10 4373 0.016 0.843 0.533 0
  i30 0.860 0.424 6.11 4502 0.020 0.855 0.611 0
  i30 0.947 0.342 8.05 4633 0.017 0.875 0.587 0
  i30 1.020 0.418 6.03 4479 0.015 0.886 0.632 0
  i30 1.107 0.393 7.10 4486 0.019 0.902 0.674 0
  i30 1.196 0.341 6.11 4649 0.016 0.914 0.689 0
  i30 1.270 0.378 8.05 4838 0.019 0.927 0.721 0
  i30 1.352 0.345 6.03 4720 0.018 0.945 0.724 0
  i30 1.431 0.346 7.10 4921 0.019 0.955 0.744 0
  i30 1.505 0.367 6.11 4906 0.015 0.972 0.758 0
  i30 1.580 0.359 8.05 4847 0.017 0.982 0.769 0
  i30 1.658 0.348 6.03 5114 0.016 0.996 0.797 0
  i30 1.732 0.354 7.10 5025 0.014 1.012 0.826 0
  i30 1.802 0.336 6.11 5205 0.017 1.024 0.841 0
  i30 1.873 0.336 8.05 5214 0.014 1.036 0.869 0
  i30 1.949 0.339 6.03 5177 0.019 1.049 0.905 0
  i30 2.018 0.328 7.10 5250 0.013 1.061 0.902 0
  i30 2.095 0.333 6.11 5309 0.013 1.076 0.942 0
  i30 2.164 0.323 8.05 5421 0.015 1.087 0.949 0
  i30 2.232 0.325 6.03 5438 0.017 1.101 0.974 0
  i30 2.296 0.308 7.10 5542 0.017 1.111 0.995 0
  i30 2.363 0.327 6.11 5583 0.015 1.124 1.007 0
  i30 2.438 0.290 8.05 5634 0.013 1.137 1.029 0
  i30 2.500 0.313 6.03 5684 0.016 1.147 1.056 0
  i30 2.571 0.274 7.10 5729 0.016 1.159 1.064 0
  i30 2.628 0.330 6.11 5783 0.015 1.169 1.084 0
  i30 2.704 0.333 8.05 5844 0.016 1.182 1.103 0
  i30 2.769 0.273 6.03 5904 0.017 1.194 1.126 0
  i30 2.822 0.285 7.10 5953 0.016 1.205 1.145 0
  i30 2.887 0.303 6.11 5977 0.016 1.215 1.161 0
  i30 2.950 0.307 8.05 6061 0.019 1.227 1.178 0
  i30 3.012 0.297 6.03 6066 0.015 1.238 1.198 0
  i30 3.077 0.277 7.10 6148 0.017 1.180 1.191 0
  i30 3.135 0.255 6.11 6144 0.020 1.226 1.187 0
  i30 3.186 0.289 8.05 6285 0.020 1.209 1.227 0
  i30 3.247 0.324 6.03 6344 0.014 1.152 1.129 0
  i30 3.317 0.339 7.10 6368 0.014 1.164 1.113 0
  i30 3.389 0.312 6.11 6402 0.018 1.175 1.122 0
  i30 3.457 0.363 8.05 6475 0.019 1.123 1.138 0
  i30 3.526 0.361 6.03 6120 0.014 1.127 1.060 0
  i30 3.598 0.363 7.10 6195 0.018 1.121 1.005 0
  i30 3.672 0.388 6.11 5994 0.018 1.089 0.979 0
  i30 3.758 0.380 8.05 5859 0.017 1.091 0.986 0
  i30 3.834 0.367 6.03 5632 0.015 1.082 0.935 0
  i30 3.921 0.410 7.10 5691 0.020 1.071 0.919 0
  i30 4.001 0.452 6.11 5599 0.015 1.034 0.896 0
  i30 4.096 0.457 8.05 5375 0.017 1.012 0.857 0
  i30 4.198 0.424 6.03 5225 0.013 0.995 0.862 0
  i30 4.290 0.452 7.10 5122 0.014 1.012 0.794 0
  i30 4.390 0.500 6.11 4900 0.018 0.986 0.747 0
  i30 4.500 0.500 8.05 4805 0.017 0.970 0.718 0
  i30 4.609 0.486 6.03 4556 0.019 0.927 0.717 0
  i30 4.714 0.513 7.10 4540 0.016 0.935 0.644 0
  i30 4.830 0.516 6.11 4245 0.018 0.893 0.608 0
  i30 4.942 0.574 8.05 4123 0.015 0.877 0.587 0
  i30 5.061 0.548 6.03 3912 0.019 0.863 0.533 0
  i30 5.181 0.580 7.10 3805 0.016 0.838 0.503 0
  i30 5.300 0.608 6.11 3593 0.017 0.828 0.458 0
  i30 5.430 0.611 8.05 3389 0.014 0.803 0.416 0
  i30 5.556 1.058 6.03 3179 0.016 0.777 0.370 0
  i30 5.695 1.332 7.10 3012 0.014 0.759 0.314 0
  i30 5.832 1.614 6.11 2783 0.013 0.732 0.268 0
  i30 5.976 1.901 8.05 2577 0.015 0.708 0.217 0
e

</score>

