Version: 1
Render: File
Ask: Yes
Options: -b128 -W -oMacintosh HD:Users:sinanbokesoy:Desktop:CsoundStuff:MacCsound (beta2):fission8.wav -s -m7 -B0 -Lstdin -R
ioView background {27421, 29038, 37660}
ioListing {10, 10} {350, 500}
sr = 44100
ksmps = 10
nchnls = 2
gkdimx init 430
gkdimy init 430
gkdimz init 430
gkcol init 0
gkpoint init 1
instr 1 ; the collision instrument
; p4 is px, p5 is py, p6 is pz
; p7 is vx, p8 is vy, p9 is vz
kdim = gkdimx*10
kcnt init p4
kcnt2 init p4
ktime init 0
ktime2 init 0
kcolchk init 1
kco init 0
kco2 init 0
kindx init 0
kindx2 init 0
ktab init 0
ktread init 1
kresult init 0
ke init 0
ktind init 0
kflag1 init 1
kflag2 init 1
kpx init p4
kpy init p5
kpz init p6
kvx init 1
kvy init 1
kvz init 1
kvx2 init -1
kvy2 init -1
kvz2 init -1
; BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
if ((kflag1==0)&&(kflag2==0)) then
kcolchk table ktread,3
kpx table ktread+1,3
kpy table ktread+2,3
kpz table ktread+3,3
ke = ke + 1
kd = int(0.5*(ke-1))
kc = int(0.5*(kd-1))
kb = int(0.5*(kc-1))
ka = int(0.5*(kb-1))
ktind1 table 7*ke+1-7 ,3
ktind2 table 7*kd+1-7 ,3
ktind3 table 7*kc+1-7 ,3
ktind4 table 7*kb+1-7 ,3
ktind5 table 7*ka+1-7 ,3
if kd = 0 then
ktind2 = 0
endif
if kc = 0 then
ktind3 = 0
endif
if kb = 0 then
ktind4 = 0
endif
if ka = 0 then
ktind5 = 0
endif
ktind = ktind1 + ktind2 + ktind3 + ktind4 + ktind5
tablew ktind,ke+1,1
;dumpk ktind, "what3", 8, 0
kcnt = kpx
kcnt2 = kpx
ktread = ktread + 7
gkpoint = gkpoint + 14
; BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
;kvx rand 500,.6
;kvx = int(kvx)/10
;if kvx = 0 then
;kvx = 1
;endif
;;kvy = kvx
;;kvz = kvx
;kvy rand 500,.3
;kvy = int(kvy)/10
;if kvy = 0 then
;kvy = 1
;endif
;kvz rand 500,.5
;kvz = int(kvz)/10
;if kvz = 0 then
;kvz = 1
;endif
kvx = 1
kvy = 1
kvz = 1
;kvx2 rand 500,.2
;kvx2 = int(kvx2)/10
;if kvx2 = 0 then
;kvx2 = 1
;endif
;kvy2 rand 500,.4
;kvy2 = int(kvy2)/10
;if kvy2 = 0 then
;kvy2 = 1
;endif
;kvz2 rand 500,.7
;kvz2 = int(kvz2)/10
;if kvz2 = 0 then
;kvz2 = 1
;endif
kvx2 = -1
kvy2 = -1
kvz2 = -1
kflag1 = 1
kflag2 = 1
endif
; BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
if kflag1 == 1 then
kcnt = kcnt+1
ktime = abs((kcnt - kpx)/kvx)
kxc = ktime*kvx+kpx
if (kxc < 0 ) then
kpxt = kpx + gkdimx*10
kxc = ktime*kvx+kpxt
endif
if (kxc > gkdimx*10 ) then
kpxt = kpx - gkdimx*10
kxc = ktime*kvx+kpxt
endif
kyc = ktime*kvy+kpy
if (kyc < 0 ) then
kpyt = kpy + gkdimx*10
kyc = ktime*kvy+kpyt
endif
if (kyc > gkdimx*10 ) then
kpyt = kpy - gkdimx*10
kyc = ktime*kvy+kpyt
endif
kzc = ktime*kvz+kpz
if (kzc < 0 ) then
kpzt = kpz + gkdimx*10
kzc = ktime*kvz+kpzt
endif
if (kzc > gkdimx*10 ) then
kpzt = kpz - gkdimx*10
kzc = ktime*kvz+kpzt
endif
kindx = ((kyc/10-1)*gkdimx+kxc/10)+((kzc/10-1)*gkdimx*gkdimy)
kerror = frac(kxc/10)
kerror1 = frac(kyc/10)
kerror2 = frac(kzc/10)
kl3 = kerror+kerror1+kerror2
endif
kindxt = kindx
if kindx > 67108868 then
ktab = 4
kindxt = kindx - 67108868
endif
if ((kindx > 50331651) && (kindx < 67108868)) then
ktab = 3
kindxt = kindx - 50331651
endif
if ((kindx > 33554434) && (kindx < 50331651)) then
ktab = 2
kindxt = kindx - 33554434
endif
if ((kindx > 16777217) && (kindx < 33554434)) then
ktab = 1
kindxt = kindx - 16777217
endif
kco1 tablekt kindxt, 4+ktab
ktab = 0
; BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
if (kco1 = 1 && kcnt > gkdimx*10) then
tablew 0,gkpoint,3
kflag1 = 0
endif
; BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
if kflag2 == 1 then
kcnt2 = kcnt2+1
;if kcnt > gkdimx*10 goto fail
ktime2 = abs((kcnt2 - kpx)/kvx2)
kxc2 = ktime2*kvx2+kpx
if (kxc2 < 0 ) then
kpxt = kpx + gkdimx*10
kxc2 = ktime2*kvx2+kpxt
endif
if (kxc2 > gkdimx*10 ) then
kpxt = kpx - gkdimx*10
kxc2 = ktime2*kvx2+kpxt
endif
kyc2 = ktime2*kvy2+kpy
if (kyc2 < 0 ) then
kpyt = kpy + gkdimx*10
kyc2 = ktime2*kvy2+kpyt
endif
if (kyc2 > gkdimx*10 ) then
kpyt = kpy - gkdimx*10
kyc2 = ktime2*kvy2+kpyt
endif
kzc2 = ktime2*kvz2+kpz
if (kzc2 < 0 ) then
kpzt = kpz + gkdimx*10
kzc2 = ktime2*kvz2+kpzt
endif
if (kzc2 > gkdimx*10 ) then
kpzt = kpz - gkdimx*10
kzc2 = ktime2*kvz2+kpzt
endif
kindx2 = ((kyc2/10-1)*gkdimx+kxc2/10)+((kzc2/10-1)*gkdimx*gkdimy)
kerrorb = frac(kxc2/10)
kerror1b = frac(kyc2/10)
kerror2b = frac(kzc2/10)
kl3b = kerrorb+kerror1b+kerror2b
;dumpk2 kcnt2, kcnt, "whata", 8, 0
endif
kindx2t = kindx2
if kindx2 > 67108868 then
ktab = 4
kindx2t = kindx2 - 67108868
endif
if ((kindx2 > 50331651) && (kindx2 < 67108868)) then
ktab = 3
kindx2t = kindx2 - 50331651
endif
if ((kindx2 > 33554434) && (kindx2 < 50331651)) then
ktab = 2
kindx2t = kindx2 - 33554434
endif
if ((kindx2 > 16777217) && (kindx2 < 33554434)) then
ktab = 1
kindx2t = kindx2 - 16777217
endif
kco2 tablekt kindx2t, 4+ktab
ktab = 0
; BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
if (kco2 = 1 && kcnt2 > gkdimx*10) then
tablew 0,gkpoint+7,3
;dumpk4 gkpoint,ktime2,kyc2,kzc2, "what5", 8, 0
kflag2 = 0
endif
; BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
;kxc mirror kxc,0,1000
;kyc mirror kyc,0,1000
;kzc mirror kzc,0,1000
if (((((kl3 == 0) && (kxc <= kdim)) && (kxc >= 0)) && ((kco1 == 1 && (kzc <= kdim && kzc >= 0)) && (kyc <= kdim && kyc>= 0)) && kcnt < kdim) && kcolchk > 0) then
tablew ktime,gkpoint, 3
tablew kxc,gkpoint+1, 3
tablew kyc,gkpoint+2, 3
tablew kzc,gkpoint+3, 3
tablew kvx,gkpoint+4, 3
tablew kvy,gkpoint+5, 3
tablew kvz,gkpoint+6, 3
dumpk3 kxc, kyc, kzc, "what", 8, 0
ktab = 0
if kindx > 67108868 then
ktab = 4
kindxt = kindx - 67108868
endif
if ((kindx > 50331651) && (kindx < 67108868)) then
ktab = 3
kindxt = kindx - 50331651
endif
if ((kindx > 33554434) && (kindx < 50331651)) then
ktab = 2
kindxt = kindx - 33554434
endif
if ((kindx > 16777217) && (kindx < 33554434)) then
ktab = 1
kindxt = kindx - 16777217
endif
tablewkt 0,kindxt,4+ktab
ktab = 0
kflag1 = 0
endif
; BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
;kxc2 mirror kxc2,0,1000
;kyc2 mirror kyc2,0,1000
;kzc2 mirror kzc2,0,1000
if (((((kl3b == 0) && (kxc2 <= kdim)) && (kxc2 >= 0)) && ((kco2 == 1 && (kzc2 <= kdim && kzc >= 0)) && (kyc2 <= kdim && kyc2>= 0)) && kcnt2 < kdim) && kcolchk > 0) then
tablew ktime2 ,gkpoint+7, 3
tablew kxc2,gkpoint+8, 3
tablew kyc2,gkpoint+9, 3
tablew kzc2,gkpoint+10, 3
tablew kvx2,gkpoint+11, 3
tablew kvy2,gkpoint+12, 3
tablew kvz2,gkpoint+13, 3
ktab = 0
kindx2t = kindx2
if kindx2 > 67108868 then
ktab = 4
kindx2t = kindx2 - 67108868
endif
if ((kindx2 > 50331651) && (kindx2 < 67108868)) then
ktab = 3
kindx2t = kindx2 - 50331651
endif
if ((kindx2 > 33554434) && (kindx2 < 50331651)) then
ktab = 2
kindx2t = kindx2 - 33554434
endif
if ((kindx2 > 16777217) && (kindx2 < 33554434)) then
ktab = 1
kindx2t = kindx2 - 16777217
endif
tablewkt 0,kindx2t,4+ktab
ktab = 0
dumpk3 kxc2, kyc2,kzc2, "what2", 8, 0
kflag2 = 0
endif
fail:
contin:
kzort = 10
endin
instr 2
kindx init 1
kindx2 init 1
kou1 table kindx,3
kou2 table kindx+1,3
kou3 table kindx+2,3
kou4 table kindx+3,3
kou5 table kindx+4,3
kou6 table kindx+5,3
kou7 table kindx+6,3
;if koux = 0 then
;printks \"kindx = %f value = %f\\n\", .001,kindx,kou,0,0
dumpk3 kou2, kou3, kou4, "coord", 8, 0
dumpk4 kou1, kou5, kou6, kou7, "speed", 8, 0
;endif
kindx = kindx + 7
kindx2 = kindx2 + 1
endin
instr 3 ; the 'event generator' instrument
kcnt init 0
kindx init 1
konset table kcnt,1
konsetr rand 1000,.6
konset = konsetr/10000 + konset
kdur table kindx,3
kdur2 table kindx+7,3
kcoor1 table kindx+1,3
kcoor1b table kindx+8,3
kcoor2 table kindx+2,3
kcoor2b table kindx+9,3
kcoor3 table kindx+3,3
kcoor3b table kindx+10,3
if kcnt < 3330 then
dumpk konset, "onset", 8, 0
event "i", 4, konset/p4, .5, 1000, 1*(kcoor1/p8)
event "i", 5, konset/p4, .5,1000, 1*(kcoor1b/p8)
;event "i", 4, konset/p5, kdur/p7, 1000, 1*(kcoor2/p8)
;event "i", 5, konset/p5, kdur2/p7,1000, 1*(kcoor2b/p8)
;event "i", 4, konset/p6, kdur/p7, 1000, 1*(kcoor3/p8)
;event "i", 5, konset/p6, kdur2/p7,1000, 1*(kcoor3b/p8)
endif
kcnt = kcnt + 1
kindx = kindx + 14
endin
instr 4 ; this instrument makes the noise!
al oscili p4, p5, 12
ar = 0
outs al, ar
endin
instr 5 ; this instrument makes the noise!
al oscili p4, p5, 12
ar = 0
outs ar, al
endin
f1 0 8193 7 0 8193 0 ; table 1
f2 0 8193 7 1 8193 1 ; table 2
f3 0 8193 7 0 8193 0 ; table 3
f4 0 16777217 7 1 16777216 1 ; table 4
f5 0 16777217 7 1 16777216 1 ; table 5
f6 0 16777217 7 1 16777216 1
f7 0 16777217 7 1 16777216 1
f8 0 16777217 7 1 16777216 1
;f9 0 16777217 7 1 16777216 1
; put here your soundfile
f12 0 524288 1 "C:\Documents and Settings\sinan\Desktop\nuclear\yd3.aif" 0 4 0
;i1 0 50 2000 2000 2000 1000 1000 1000 1 2
i1 0 40 2000 2000 2000 1000 1000 1000 1 2
i2 40 1
; on1 on2 on3 dur pitch
i3 41 40 500 500 500 10000 50000
;i4 0