| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
</CsOptions> |
| 4 |
<CsInstruments> |
| 5 |
; cyclic bells |
| 6 |
; author: steven yi |
| 7 |
; released: 2004.02.03 |
| 8 |
; |
| 9 |
; I had gone to East-West books in New York and while there had heard some lovely bell sounds. |
| 10 |
; The sounds were coming from a thing in the back that had water flowing into a small basin. |
| 11 |
; Inside the basin were a ring of fixed, different sized bells, as well as a couple of floating bells. |
| 12 |
; As the floating bells floated around the circle they would occasionally hit the ring of bells. |
| 13 |
; |
| 14 |
; This version is based on score generation functions I had written in python, and was written |
| 15 |
; with Csound facilities alone. |
| 16 |
; |
| 17 |
; This is meant to be performed in realtime. The commandline I used to operate this is: |
| 18 |
; |
| 19 |
; csound -d -o dac cyclicBells.csd |
| 20 |
|
| 21 |
nchnls = 2 |
| 22 |
|
| 23 |
gi_hit_probability = 0.20 |
| 24 |
|
| 25 |
instr 1 ;fmbell |
| 26 |
ipch = p4 |
| 27 |
ipch2 = p5 |
| 28 |
|
| 29 |
ipch = (ipch < 15 ? cpspch(ipch) : ipch); |
| 30 |
ipch2 = (ipch2 < 15 ? cpspch(ipch2) : ipch2); |
| 31 |
|
| 32 |
kpchline line ipch, p3, ipch2 |
| 33 |
|
| 34 |
iamp = ampdb(p6) |
| 35 |
iSpace = p7 |
| 36 |
ienvType = p8 |
| 37 |
|
| 38 |
itable = 4 |
| 39 |
|
| 40 |
kenv init 0 |
| 41 |
|
| 42 |
print ipch, ipch2 |
| 43 |
|
| 44 |
if ienvType == 0 kgoto env0 ; adsr |
| 45 |
if ienvType == 1 kgoto env1 ; pyramid |
| 46 |
if ienvType == 2 kgoto env2 ; ramp |
| 47 |
|
| 48 |
env0: |
| 49 |
|
| 50 |
kenv adsr .3, .2, .9, .5 |
| 51 |
|
| 52 |
kgoto endEnvelope |
| 53 |
|
| 54 |
env1: |
| 55 |
|
| 56 |
kenv linseg 0, p3 * .5, 1, p3 * .5, 0 |
| 57 |
|
| 58 |
kgoto endEnvelope |
| 59 |
|
| 60 |
env2: |
| 61 |
|
| 62 |
kenv linseg 0, p3 - .1, 1, .1, 0 |
| 63 |
|
| 64 |
kgoto endEnvelope |
| 65 |
|
| 66 |
endEnvelope: |
| 67 |
|
| 68 |
; INSERT SOUND GENERATING CODE HERE |
| 69 |
|
| 70 |
kc1 = 5 |
| 71 |
kc2 = 5 |
| 72 |
kvdepth = 0.005 |
| 73 |
kvrate = 6 |
| 74 |
ifn1 = 1 |
| 75 |
ifn2 = 1 |
| 76 |
ifn3 = 1 |
| 77 |
ifn4 = 1 |
| 78 |
ivfn = 1 |
| 79 |
|
| 80 |
|
| 81 |
aout fmbell iamp, kpchline, kc1, kc2, kvdepth, kvrate, ifn1, ifn2, ifn3, ifn4, ivfn |
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
; PANNING CODE |
| 86 |
iSpace = (iSpace-.5) * 3.14159265359 |
| 87 |
krtl = sqrt(2) / 2 * (cos(iSpace) + sin(iSpace)) ; CONSTANT POWER PANNING |
| 88 |
krtr = sqrt(2) / 2 * (cos(iSpace) - sin(iSpace)) ; FROM C.ROADS "CM TUTORIAL" pp460 |
| 89 |
|
| 90 |
aLeft = aout * krtl |
| 91 |
aRight = aout * krtr |
| 92 |
|
| 93 |
outs aLeft, aRight |
| 94 |
|
| 95 |
;ga1 = ga1 + aLeft |
| 96 |
;ga2 = ga2 + aRight |
| 97 |
|
| 98 |
|
| 99 |
endin |
| 100 |
|
| 101 |
instr 2 ;event generator |
| 102 |
iTableNum = p4 |
| 103 |
iBaseAmp = p5 |
| 104 |
iPan = p6 |
| 105 |
|
| 106 |
kcount init 5 * kr |
| 107 |
kdur init 4 * kr |
| 108 |
kHit init 0 |
| 109 |
|
| 110 |
kIndex init 0 |
| 111 |
|
| 112 |
if (kcount < kdur) kgoto counterup |
| 113 |
|
| 114 |
kHit rnd31 .5, 0 |
| 115 |
kHit = kHit + .5 |
| 116 |
|
| 117 |
if (kHit > gi_hit_probability) kgoto nohit |
| 118 |
kpch1 table 0, iTableNum |
| 119 |
kpch2 table kIndex, iTableNum |
| 120 |
|
| 121 |
kamp = iBaseAmp - (kHit * 5) |
| 122 |
|
| 123 |
event "i", 1, 0, 10, kpch1, kpch1, kamp, iPan, 0 |
| 124 |
event "i", 1, 0, 10, kpch2, kpch2, kamp, iPan, 0 |
| 125 |
|
| 126 |
kdur = (kHit * 3) + 3 |
| 127 |
kdur = kdur * kr |
| 128 |
|
| 129 |
|
| 130 |
nohit: |
| 131 |
kIndex = kIndex + 1 |
| 132 |
|
| 133 |
if (kIndex < 5) kgoto noZeroing |
| 134 |
kIndex = 0 |
| 135 |
|
| 136 |
noZeroing: |
| 137 |
|
| 138 |
kcount = 0 |
| 139 |
counterup: |
| 140 |
kcount = kcount + 1 |
| 141 |
|
| 142 |
endin |
| 143 |
|
| 144 |
|
| 145 |
</CsInstruments> |
| 146 |
<CsScore> |
| 147 |
|
| 148 |
f1 0 65536 10 1 |
| 149 |
|
| 150 |
;center pitches = [10.00, 10.01, 10.02, 10.04, 10.07] |
| 151 |
;left pitches = [10.07, 10.00, 10.01, 10.02, 10.04] |
| 152 |
;right pitches = [10.01, 10.02, 10.04, 10.07, 10.00] |
| 153 |
|
| 154 |
f10 0 8 -2 10.00 10.01 10.02 10.04 10.07 0 0 0 |
| 155 |
f11 0 8 -2 10.07 10.00 10.01 10.02 10.04 0 0 0 |
| 156 |
f12 0 8 -2 10.01 10.02 10.04 10.07 10.00 0 0 0 |
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
i2 0 3600 10 62 0 |
| 161 |
i2 .33 3600 11 64 -.2 |
| 162 |
i2 .49 3600 12 64 .2 |
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
i1 0.0 6.0 10.00 10.00 70 0 0 |
| 167 |
e |
| 168 |
|
| 169 |
</CsScore> |
| 170 |
|
| 171 |
</CsoundSynthesizer> |