| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
;=========================================================== |
| 5 |
; schottstaedt.orc |
| 6 |
;=========================================================== |
| 7 |
|
| 8 |
sr = 44100 |
| 9 |
kr = 2205 |
| 10 |
ksmps = 20 |
| 11 |
nchnls = 2 |
| 12 |
|
| 13 |
|
| 14 |
; functions for the schottstaedt string |
| 15 |
giSineWave ftgen 1, 0, 512, 10, 1 |
| 16 |
giTable1 ftgen 2, 0, 129, 7, 1, 129, 0 |
| 17 |
giVibEnvlp ftgen 3, 0, 129, 5, .01, 129, 1 |
| 18 |
giPanLeft ftgen 10, 0, 129, 9, .25, 1, 90 |
| 19 |
giPanRight ftgen 11, 0, 129, 9, .25, 1, 0 |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
instr 1 ; a schottstaedt string instrument |
| 24 |
;=========================================================== |
| 25 |
; p4=amp(0-1) p5=pitch(in oct) p6=pan(0=l, 1=r) |
| 26 |
;=========================================================== |
| 27 |
; set constants |
| 28 |
iamp = 32767*p4 |
| 29 |
|
| 30 |
icps = cpsoct(p5) |
| 31 |
|
| 32 |
; check to see if pan is out of our range |
| 33 |
ipanfac = (p6 > 1 ? 1 : p6) |
| 34 |
ipanfac = (p6 < 0 ? 0 : ipanfac) |
| 35 |
; map linear pan factor to more natural sqrt function |
| 36 |
ilpan tablei ipanfac,10,1 |
| 37 |
irpan tablei ipanfac,11,1 |
| 38 |
|
| 39 |
indx1 = 7.5/log(icps) |
| 40 |
indx2 = (8.5-log(icps))/(3+icps*1000) |
| 41 |
indx3 = 1.25/sqrt(icps) |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
;vibrato unit |
| 46 |
krnd randi .0075,15 |
| 47 |
kvibe oscil1i 0,.015,p3/4,3 ;envlp for vibrato |
| 48 |
kvib oscili krnd+kvibe,5.5*kvibe,1 |
| 49 |
|
| 50 |
;attack noise |
| 51 |
kgaten oscil1i 0,iamp/5,.2,2 |
| 52 |
krnd randi kgaten,.2*icps |
| 53 |
anoise oscili krnd,2000,1 |
| 54 |
|
| 55 |
;main unit |
| 56 |
kgate oscil1i 0,1,.2,2 ;envlp for indicies to make |
| 57 |
;chiff sound |
| 58 |
|
| 59 |
amod1 oscili (kgate+indx1)*icps,icps,1 |
| 60 |
amod2 oscili (kgate+indx2)*3*icps,3*icps,1 ;modulators |
| 61 |
amod3 oscili (kgate+indx3)*4*icps,4*icps,1 |
| 62 |
|
| 63 |
amods = icps+amod1+amod2+amod3 |
| 64 |
|
| 65 |
asig oscili iamp,amods*(kvib+1),1 ;carrier oscil with vibrato |
| 66 |
|
| 67 |
asigs linen asig+anoise,.2,p3,.2 ;final envlp for oscil+noise |
| 68 |
|
| 69 |
outs asigs*ilpan,asigs*irpan |
| 70 |
|
| 71 |
endin |