| Hi,
In instrument 4 the orbit is a coiled path traced out on the surface of a
torus. This is then used to reference the 4D surface. With instrument 5
the coordinates are sent to a 4D rotation instrument so a stereo image is
created.
Bye,
Hans Mikelson
; ORCHESTRA
; Terrain Mapping
; Coded by Hans Mikelson February 13, 1998
;
sr=22050
kr=2205
ksmps=10
nchnls=2
zakinit 50, 50
; 4D
; w=sin^2*(sqrt(x^2+y^2+z^2))
instr 4
idur = p3
iamp = p4
ifqc = cpspch(p5)
kdclick linseg 0, .002, iamp, idur-.004, iamp, .002, 0
krminor linseg .5, idur/2, 5, idur/2, .5
krmajor = krminor+1
asin1 oscil krminor, ifqc, 1
acos1 oscil krminor, ifqc, 1, .25
asin2 oscil krmajor, ifqc/4, 1
acos2 oscil krmajor, ifqc/4, 1, .25
ax = asin1+acos2
ay = acos1
az = asin2
az1 = sin(sqrt(ax*ax+ay*ay+az*az)) ; Compute the surface
az = az1*az1-.5
outs az*kdclick, az*kdclick
endin
; 4D
; w=sin^2*(sqrt(x^2+y^2+z^2))
instr 5
idur = p3
iamp = p4
ifqc = cpspch(p5)
ioutch1 = p6
ioutch2 = p7
ioutch3 = p8
ioutch4 = p9
kdclick linseg 0, .002, iamp, idur-.004, iamp, .002, 0
krminor linseg .5, idur/2, 5, idur/2, .5
krmajor = krminor+1
asin1 oscil krminor, ifqc, 1
acos1 oscil krminor, ifqc, 1, .25
asin2 oscil krmajor, ifqc/4, 1
acos2 oscil krmajor, ifqc/4, 1, .25
ax = asin1+acos2
ay = acos1
az = asin2
aw1 = sin(sqrt(ax*ax+ay*ay+az*az)) ; Compute the surface
aw = aw1*aw1-.5
zaw ax*kdclick, ioutch1
zaw ay*kdclick, ioutch2
zaw az*kdclick, ioutch3
zaw aw*kdclick*10, ioutch4
endin
; 3 Space Planar Rotations
instr 50
ifqc = p4
iphase = p5
iplane = p6
inx = p7
iny = p8
inz = p9
ioutx = p10
iouty = p11
ioutz = p12
kcost oscil 1, ifqc, 1, .25+iphase
ksint oscil 1, ifqc, 1, iphase
ax zar inx
ay zar iny
az zar inz
; Rotation in X-Y plane
if (iplane!=1) goto next1
axr = ax*kcost + ay*ksint
ayr =-ax*ksint + ay*kcost
azr = az
goto next3
; Rotation in X-Z plane
next1:
if (iplane!=2) goto next2
axr = ax*kcost + az*ksint
ayr = ay
azr =-ax*ksint + az*kcost
goto next 3
; Rotation in Y-Z plane
next2:
axr = ax
ayr = ay*kcost + az*ksint
azr =-ay*ksint + az*kcost
next3:
zaw axr, ioutx
zaw ayr, iouty
zaw azr, ioutz
endin
; 4 Space Planar Rotations
instr 51
ifqc = p4
iphase = p5
iplane = p6
inx = p7
iny = p8
inz = p9
inw = p10
ioutx = p11
iouty = p12
ioutz = p13
ioutw = p14
kcost oscil 1, ifqc, 1, .25+iphase
ksint oscil 1, ifqc, 1, iphase
ax zar inx
ay zar iny
az zar inz
aw zar inw
; Rotation in X-Y plane
if (iplane!=1) goto next1
axr = ax*kcost + ay*ksint
ayr =-ax*ksint + ay*kcost
azr = az
awr = aw
goto nextend
; Rotation in X-Z plane
next1:
if (iplane!=2) goto next2
axr = ax*kcost + az*ksint
ayr = ay
azr =-ax*ksint + az*kcost
awr = aw
goto nextend
; Rotation in Y-Z plane
next2:
if (iplane!=3) goto next3
axr = ax
ayr = ay*kcost + az*ksint
azr =-ay*ksint + az*kcost
awr = aw
goto nextend
; Rotation in X-W plane
next3:
if (iplane!=4) goto next4
axr = ax*kcost + aw*ksint
ayr = ay
azr = az
awr = -ax*ksint + aw*kcost
goto nextend
; Rotation in Y-W plane
next4:
if (iplane!=5) goto next5
axr = ax
ayr = ay*kcost + az*ksint
azr = az
awr = -ay*ksint + aw*kcost
goto nextend
; Rotation in Z-W plane
next5:
if (iplane!=6) goto nextend
axr = ax
ayr = ay
azr = az*kcost + aw*ksint
awr =-az*ksint + aw*kcost
nextend:
zaw axr, ioutx
zaw ayr, iouty
zaw azr, ioutz
zaw awr, ioutw
endin
;---------------------------------------------------------------------------
; Mixer Section
;---------------------------------------------------------------------------
instr 100
idur = p3
iamp = p4
inch1 = p5
inch2 = p6
ain1 zar inch1
ain2 zar inch2
outs ain1*iamp, ain2*iamp
endin
;---------------------------------------------------------------------------
; Clear audio & control channels
;---------------------------------------------------------------------------
instr 110
zacl 0, 50 ; Clear audio channels 0 to 30
zkcl 0, 50 ; Clear control channels 0 to 30
endin
; SCORE
f1 0 8192 10 1
; Sta Dur Amp Pch
i4 0 2 20000 9.00
; Sta Dur Amp Pch OutX OutY OutZ OutW
i5 2 2 2000 9.00 1 2 3 4
; 3 Space Planar Rotation
; 1=X-Y Plane, 2=X-Z Plane, 3=Y-Z Plane
; Sta Dur Fqc Phase Plane InX InY InZ OutX OutY OutZ
;i50 0 1.6 1.5 0 2 1 2 3 4 5 6
; 4 Space Planar Rotation
; Plane: 1=X-Y, 2=X-Z, 3=Y-Z, 4=X-W, 5=Y-W, 6=Z-W
; Sta Dur Fqc Phase Plane InX InY InZ InW OutX OutY OutZ OutW
i51 2 2 1.5 0 1 1 2 3 4 5 6 7 8
i51 2 2 1.2 0 6 5 6 7 8 9 10 11 12
i51 2 2 1.0 0 5 9 10 11 12 13 14 15 16
; Mixer
; Sta Dur Amp InCh1 InCh2
i100 2 2 1 14 16
; Clear Zak
; Sta Dur
i110 2 2
|