sr = 44100
kr = 441
ksmps = 100
nchnls = 2
gidecchnls = 8 ; specifies the speaker setup:
; 2 = stereo speaker setup
; 4 = quattro (square) speaker setup
; 5 = pentagon speaker setup
; 5.1 = 5.1 surround speaker setup
; 6 = hexagonoctogon1
; 8.1 = octogon1
; 8.2 = octogon2
; 8 = cube
; 12.1= dodecahedron1
; 12.2= dodecahedron2
#define FILE #Filename-# ;insert filename here
#define HEADER #aif# ;insert filetype here
girescale = 1 ; for test decoding
; girescale = ; for 2chnl decoding
; girescale = ; for 5 chnl encoding
; girescale = ; for 5.1 chnl encoding
; girescale = ; for octogon1 decoding
; girescale = ; for octogon2 decoding
; girescale = ; for 8chnl cube decoding
; girescale = ; for dodecahedron1 decoding
; girescale = ; for dodecahedron2 decoding
giformat = 2
; **************************************************************************************
instr 81 ; First ORDER AMBISONICS DECODER coded 1999-2002 by Jan Jacob Hofmann.
; FURSE - MALHAM - SET OF EQUATIONS Version 1.1 - Feb. 12th 2007
; More sets of speaker- layouts may be discovered at http://www.sonicarchitecture.de
; http://www.muse.demon.co.uk/ref/speakers.html Thanks to Richard Furse and Dave Malham
; **************************************************************************************
ieqshift = p4 ; factor for shifting between spherical harmonic [0] decoding matrix and controlled opposites [1] decoding matrix
; choose any factor between 0 and 1
; [0] produces a strict idealised response that satisfies the Ambisonic matching equations.
; Generally this type of configuration produces a relatively small stable listening area.
; [1] produces an `in-phase' response and each speaker will have only a single maximum given a moving virtual sound source.
; Values of ieqshift closer to 0 are only recomended if a sufficient number of speakers are available.
;aw, ax, ay, az soundin "$FILE.$HEADER." ; input for encoded 4 chnl- files
aw soundin "$FILE.w.$HEADER." ; input for encoded mono- files
ax soundin "$FILE.x.$HEADER."
ay soundin "$FILE.y.$HEADER."
az soundin "$FILE.z.$HEADER."
aw = aw * girescale
ax = ax * girescale
ay = ay * girescale
az = az * girescale
if gidecchnls == 2 goto stereo ; goto 2chnl decode
if gidecchnls == 4 goto square ; goto 4chnl decode
if gidecchnls == 5 goto penta ; goto 5chnl decode
if gidecchnls == 5.1 goto surround ; goto surround5.1 decode
if gidecchnls == 6 goto hexagon ; goto 6chnl decode
if gidecchnls == 8.1 goto octagon1 ; goto 8chnl decode (octogon 1)
if gidecchnls == 8.2 goto octagon2 ; goto 8chnl decode (octogon 2)
if gidecchnls == 8 goto cube ; goto 8chnl decode
if gidecchnls == 12.1 goto dodecahedron1 ; goto 12chnl decode (dodecahedron1)
if gidecchnls == 12.2 goto dodecahedron2 ; goto 12chnl decode (dodecahedron2)
; ******************************************************************************************************************************
stereo: ; 2chnl (stereo ) decode,2nd order (second order controlled opposites)
; ******************************************************************************************************************************
;Rig `Controlled Opposites' Decode Matrix (second Order)
; w x y z
; Speaker1 <0.0000,1.0000,0.0000> left
achnl1 sum aw * 0.7071, ay * 0.5000
; Speaker2 <0.0000,-1.0000,0.0000> right
achnl2 sum aw * 0.7071, ay * -0.5000
outs achnl1, achnl2
; soundout achnl1, "$FILE.dec1.$HEADER.",giformat
; soundout achnl2, "$FILE.dec2.$HEADER.",giformat
fout "$FILE.stereo.$HEADER.", giformat, achnl1, achnl2
goto skipend
; ******************************************************************************************************************************
square: ; Rig `Controlled Opposites' Decode Matrix (First Order)
; ******************************************************************************************************************************
; This rig configuration produces an `in-phase' response and each speaker will have only a single maximum given a moving virtual sound source.
; w x y z
; Speaker1<0.7071,0.7071,0.0000> left front
achnl1 sum aw *0.3536, ax *0.3536, ay * 0.3536
; Speaker2<0.7071,-0.7071,0.0000> right front
achnl2 sum aw *0.3536, ax *0.3536, ay * -0.3536
; Speaker3<-0.7071,-0.7071,0.0000> right back
achnl3 sum aw *0.3536, ax *-0.3536, ay * -0.3536
; Speaker4 <-0.7071,0.7071,0.0000> left back
achnl4 sum aw *0.3536, ax -0.3536, ay * 0.3536
kpeak1 peak achnl1
kpeak2 peak achnl2
kpeak3 peak achnl3
kpeak4 peak achnl4
printk p3, kpeak1,0
printk p3, kpeak2,4
printk p3, kpeak3,8
printk p3, kpeak4,12
fout "$FILE.squaredec1.$HEADER.", giformat, achnl1
fout "$FILE.squaredec2.$HEADER.", giformat, achnl2
fout "$FILE.squaredec3.$HEADER.", giformat, achnl3
fout "$FILE.squaredec4.$HEADER.", giformat, achnl4
goto skipend
; ******************************************************************************************************************************
penta:
; ******************************************************************************************************************************
; This rig configuration produces an `in-phase' response and each speaker will have only a single maximum given a moving virtual sound source.
; w x y z
; Speaker1 <0.8090,0.5878,0.0000> front left
achnl1 sum aw *0.2828, ax *0.1618, ay * 0.1176
; Speaker2 <-0.3090,0.9511,0.0000> back left
achnl2 sum aw *0.2828, ax *-0.0618,ay * 0.1902
; Speaker3 <-1.0000,0.0000,0.0000> back
achnl3 sum aw *0.2828, ax * -0.2
; Speaker4 <-0.3090,-0.9511,0.0000> back right
achnl4 sum aw *0.2828, ax *-0.0618, ay * -0.1902
; Speaker5 <0.8090,-0.5878,0.0000> front right
achnl5 sum aw *0.2828, ax *0.1618, ay * -0.1176
kpeak1 peak achnl1
kpeak2 peak achnl2
kpeak3 peak achnl3
kpeak4 peak achnl4
kpeak5 peak achnl5
printk p3, kpeak1,0
printk p3, kpeak2,4
printk p3, kpeak3,8
printk p3, kpeak4,12
printk p3, kpeak5,16
fout "$FILE.pentadec1.$HEADER.", giformat, achnl1
fout "$FILE.pentadec2.$HEADER.", giformat, achnl2
fout "$FILE.pentadec3.$HEADER.", giformat, achnl3
fout "$FILE.pentadec4.$HEADER.", giformat, achnl4
fout "$FILE.pentadec5.$HEADER.", giformat, achnl5
goto skipend
; ******************************************************************************************************************************
surround: ; Rig `Controlled Opposites' Decode Matrix (First Order controlled opposites)
; Note that the second order rig has a high symmetry distortion rating. Such a rig is likely to provide an unstable image.
; ******************************************************************************************************************************
; w x y z
; Speaker 1 <0.8660,0.5000,0.0000> front left
achnl1 sum aw *0.1690, ax *0.0797, ay * 0.0891
; Speaker 2<1.0000,0.0000,0.0000> front center
achnl2 sum aw *0.1635, ax * 0.0923
; Speaker 3<0.8660,-0.5000,0.0000> front right
achnl3 sum aw *0.1690, ax *0.0797, ay * -0.0891
; Speaker 4<-0.5000,0.8660,0.0000> back left
achnl4 sum aw *0.4563, ax *-0.1259,ay * 0.1543
; Speaker 5<-0.5000,-0.8660,0.0000> back right
achnl5 sum aw *0.4563, ax *-0.1259,ay * -0.1543
kpeak1 peak achnl1
kpeak2 peak achnl2
kpeak3 peak achnl3
kpeak4 peak achnl4
kpeak5 peak achnl5
printk p3, kpeak1,0
printk p3, kpeak2,4
printk p3, kpeak3,8
printk p3, kpeak4,12
printk p3, kpeak5,16
fout "$FILE.5_1dec1.$HEADER.", giformat, achnl1 ;front-left
fout "$FILE.5_1dec2.$HEADER.", giformat, achnl2 ;front-center
fout "$FILE.5_1dec3.$HEADER.", giformat, achnl3 ;front-right
fout "$FILE.5_1dec4.$HEADER.", giformat, achnl4 ;back-left
fout "$FILE.5_1dec5.$HEADER.", giformat, achnl5 ;back-right
goto skipend
; ******************************************************************************************************************************
hexagon: ; 6 chnl decode (hexagon) first order
; ******************************************************************************************************************************
; Rig Decode Matrix to Reproduce Spherical Harmonics (First Order)
; This rig configuration produces a strict idealised response that satisfies the Ambisonic matching equations.
; Generally this type of configuration produces a relatively small stable listening area. (See controlled opposites below.)
achnlsh1 init 0
achnlsh2 init 0
achnlsh3 init 0
achnlsh4 init 0
achnlsh5 init 0
achnlsh6 init 0
achnlco1 init 0
achnlco2 init 0
achnlco3 init 0
achnlco4 init 0
achnlco5 init 0
achnlco6 init 0
if ieqshift = 1 goto hexcontrolled
; w x y z
; Speaker 1 <0.8660,0.5000,0.0000>
achnlsh1 sum aw *0.2357, ax *0.2887, ay * 0.1667
; Speaker 2 <0.0000,1.0000,0.0000>
achnlsh2 sum aw * 0.2357, ay * 0.3333
; Speaker 3 <-0.8660,0.5000,0.0000>
achnlsh3 sum aw *0.2357, ax *-0.2887, ay * 0.1667
; Speaker 4 <-0.8660,-0.5000,0.0000>
achnlsh4 sum aw *0.2357, ax *-0.2887, ay * -0.1667
; Speaker 5 <0.0000,-1.0000,0.0000>
achnlsh5 sum aw * 0.2357, ay * -0.3333
; Speaker 6 <0.8660,-0.5000,0.0000>
achnlsh6 sum aw *0.2357, ax *0.2887, ay * -0.1667
if ieqshift = 0 goto hexmix
hexcontrolled:
; Rig decode matrix to reproduce controlled opposites (First Order)
; w x y z
; Speaker 1 <0.8660,0.5000,0.0000>
achnlco1 sum aw *0.2357, ax *0.1443, ay * 0.0833
; Speaker 2 <0.0000,1.0000,0.0000>
achnlco2 sum aw * 0.2357, ay * 0.1667
; Speaker 3 <-0.8660,0.5000,0.0000>
achnlco3 sum aw *0.2357, ax *-0.1443, ay * 0.0833
; Speaker 4 <-0.8660,-0.5000,0.0000>
achnlco4 sum aw *0.2357, ax *-0.1443, ay * -0.0833
; Speaker 5 <0.0000,-1.0000,0.0000>
achnlco5 sum aw * 0.2357, ay * -0.1667
; Speaker 6 <0.8660,-0.5000,0.0000>
achnlco6 sum aw *0.2357, ax *0.1443, ay * -0.0833
hexmix:
achnl1 sum achnlco1 * ieqshift, achnlsh1 * 1 - ieqshift
achnl2 sum achnlco2 * ieqshift, achnlsh2 * 1 - ieqshift
achnl3 sum achnlco3 * ieqshift, achnlsh3 * 1 - ieqshift
achnl4 sum achnlco4 * ieqshift, achnlsh4 * 1 - ieqshift
achnl5 sum achnlco5 * ieqshift, achnlsh5 * 1 - ieqshift
achnl6 sum achnlco6 * ieqshift, achnlsh6 * 1 - ieqshift
kpeak1 peak achnl1
kpeak2 peak achnl2
kpeak3 peak achnl3
kpeak4 peak achnl4
kpeak5 peak achnl5
kpeak6 peak achnl6
printk p3, kpeak1,0
printk p3, kpeak2,4
printk p3, kpeak3,8
printk p3, kpeak4,12
printk p3, kpeak5,16
printk p3, kpeak6,20
fout "$FILE.hexdec1.$HEADER.", giformat, achnl1
fout "$FILE.hexdec2.$HEADER.", giformat, achnl2
fout "$FILE.hexdec3.$HEADER.", giformat, achnl3
fout "$FILE.hexdec4.$HEADER.", giformat, achnl4
fout "$FILE.hexdec5.$HEADER.", giformat, achnl5
fout "$FILE.hexdec6.$HEADER.", giformat, achnl6
goto skipend
; ******************************************************************************************************************************
octagon1: ; 8 chnl decode (octagon 1),first order
; ******************************************************************************************************************************
; Rig Decode Matrix to Reproduce Spherical Harmonics (First Order)
; This rig configuration produces a strict idealised response that satisfies the Ambisonic matching equations.
; Generally this type of configuration produces a relatively small stable listening area. (See controlled opposites below.)
achnlsh1 init 0
achnlsh2 init 0
achnlsh3 init 0
achnlsh4 init 0
achnlsh5 init 0
achnlsh6 init 0
achnlsh7 init 0
achnlsh8 init 0
achnlco1 init 0
achnlco2 init 0
achnlco3 init 0
achnlco4 init 0
achnlco5 init 0
achnlco6 init 0
achnlco7 init 0
achnlco8 init 0
if ieqshift = 1 goto octo1controlled
; w x y z
; Speaker 1 <0.9239,0.3827,0.0000> front left
achnlsh1 sum aw *0.1768, ax *0.231, ay * 0.0957
; Speaker 2 <0.3827,0.9239,0.0000> front midleft
achnlsh2 sum aw *0.1768, ax *0.0957, ay * 0.231
; Speaker 3 <-0.3827,0.9239,0.0000> back midleft
achnlsh3 sum aw *0.1768, ax *-0.0957, ay * 0.231
; Speaker 4 <-0.9239,0.3827,0.0000> back left
achnlsh4 sum aw *0.1768, ax *-0.231, ay * 0.0957
; Speaker 5 <-0.9239,-0.3827,0.0000> back right
achnlsh5 sum aw *0.1768, ax *-0.231, ay * -0.0957
; Speaker 6 <-0.3827,-0.9239,0.0000> back midright
achnlsh6 sum aw *0.1768, ax *-0.0957, ay * -0.231
; Speaker 7 <0.3827,-0.9239,0.0000> front midright
achnlsh7 sum aw *0.1768, ax *0.0957, ay * -0.231
; Speaker 8 <0.9239,-0.3827,0.0000> front right
achnlsh8 sum aw *0.1768, ax * 0.231, ay * -0.0957
if ieqshift = 0 goto octo1mix
octo1controlled:
; Rig decode matrix to reproduce controlled opposites (First Order)
; w x y z
; Speaker 1 <0.924,0.383,0.000> front left
achnlco1 sum aw *1.768, ax*0.1155, ay * 0.0478
; Speaker 2 <0.383,0.924,0.000> front midleft
achnlco2 sum aw *1.768, ax*0.0478, ay * 0.1155
; Speaker 3 <-0.383,0.924,0.000> back midleft
achnlco3 sum aw * 1.768, ax*-0.0478, ay * 0.1155
; Speaker 4 <-0.924,0.383,0.000> back left
achnlco4 sum aw *1.768, ax*-0.1155, ay * 0.0478
; Speaker5 <-0.924,-0.383,0.000> back right
achnlco5 sum aw *1.768, ax*-0.1155, ay * -0.0478
; Speaker 6 <-0.383,-0.924,0.000> back midright
achnlco6 sum aw *1.768, ax*-0.0478, ay * -0.1155
; Speaker 7 <0.383,-0.924,0.000> front midright
achnlco7 sum aw *1.768, ax* 0.0478, ay * -0.1155
; Speaker 8 <0.924,-0.383,0.000> front right
achnlco8 sum aw *1.768, ax *0.1155, ay * -0.0478
octo1mix:
achnl1 sum achnlco1 * ieqshift, achnlsh1 * 1 - ieqshift
achnl2 sum achnlco2 * ieqshift, achnlsh2 * 1 - ieqshift
achnl3 sum achnlco3 * ieqshift, achnlsh3 * 1 - ieqshift
achnl4 sum achnlco4 * ieqshift, achnlsh4 * 1 - ieqshift
achnl5 sum achnlco5 * ieqshift, achnlsh5 * 1 - ieqshift
achnl6 sum achnlco6 * ieqshift, achnlsh6 * 1 - ieqshift
achnl7 sum achnlco7 * ieqshift, achnlsh7 * 1 - ieqshift
achnl8 sum achnlco8 * ieqshift, achnlsh8 * 1 - ieqshift
kpeak1 peak achnl1
kpeak2 peak achnl2
kpeak3 peak achnl3
kpeak4 peak achnl4
kpeak5 peak achnl5
kpeak6 peak achnl6
kpeak7 peak achnl7
kpeak8 peak achnl8
printk p3, kpeak1,0
printk p3, kpeak2,4
printk p3, kpeak3,8
printk p3, kpeak4,12
printk p3, kpeak5,16
printk p3, kpeak6,20
printk p3, kpeak7,24
printk p3, kpeak8,28
fout "$FILE.oct1dec1.$HEADER.", giformat, achnl1
fout "$FILE.oct1dec2.$HEADER.", giformat, achnl2
fout "$FILE.oct1dec3.$HEADER.", giformat, achnl3
fout "$FILE.oct1dec4.$HEADER.", giformat, achnl4
fout "$FILE.oct1dec5.$HEADER.", giformat, achnl5
fout "$FILE.oct1dec6.$HEADER.", giformat, achnl6
fout "$FILE.oct1dec7.$HEADER.", giformat, achnl7
fout "$FILE.oct1dec8.$HEADER.", giformat, achnl8
goto skipend
; ******************************************************************************************************************************
octagon2: ; 8 chnl decode (octagon 2),first order (controlled opposites)
; ******************************************************************************************************************************
; Rig Decode Matrix to Reproduce Spherical Harmonics (First Order)
; This rig configuration produces a strict idealised response that satisfies the Ambisonic matching equations.
; Generally this type of configuration produces a relatively small stable listening area. (See controlled opposites below.)
achnlsh1 init 0
achnlsh2 init 0
achnlsh3 init 0
achnlsh4 init 0
achnlsh5 init 0
achnlsh6 init 0
achnlsh7 init 0
achnlsh8 init 0
achnlco1 init 0
achnlco2 init 0
achnlco3 init 0
achnlco4 init 0
achnlco5 init 0
achnlco6 init 0
achnlco7 init 0
achnlco8 init 0
if ieqshift = 1 goto octo2controlled
; w x y z
; Speaker 1 <1.0000,0.0000,0.0000> front left
achnlsh1 sum aw *0.1768, ax * 0.2500
; Speaker 2 <0.7071,0.7071,0.0000> front midleft
achnlsh2 sum aw *0.1768, ax *0.1768, ay * 0.1768
; Speaker 3 <0.0000,1.0000,0.0000> back midleft
achnlsh3 sum aw * 0.1768, ay * 0.2500
; Speaker 4 <-0.7071,0.7071,0.0000> back left
achnlsh4 sum aw *0.1768, ax *-0.1768, ay * 0.1768
; Speaker 5 <-1.0000,0.0000,0.0000> back right
achnlsh5 sum aw *0.1768, ax * -0.2500
; Speaker 6 <-0.7071,-0.7071,0.0000> back midright
achnlsh6 sum aw *0.1768, ax *-0.1768, ay * -0.1768
; Speaker 7 <0.0000,-1.0000,0.0000> front midright
achnlsh7 sum aw * 0.1768, ay * -0.2500
; Speaker 8 <0.7071,-0.7071,0.0000> front right
achnlsh8 sum aw *0.1768, ax *0.1768, ay * -0.1768
if ieqshift = 0 goto octo2mix
octo2controlled:
; Rig decode matrix to reproduce controlled opposites (First Order)
; w x y z
; Speaker 1 <1.0000,0.0000,0.0000>
achnlco1 sum aw *0.1768, ax * 0.1250
; Speaker 2 <0.7071,0.7071,0.0000>
achnlco2 sum aw *0.1768, ax *0.0884, ay * 0.0884
; Speaker 3 <0.0000,1.0000,0.0000>
achnlco3 sum aw *0.1768, ay * 0.1250
; Speaker 4 <-0.7071,0.7071,0.0000>
achnlco4 sum aw *0.1768, ax *-0.0884, ay * 0.0884
; Speaker 5 <-1.0000,0.0000,0.0000>
achnlco5 sum aw *0.1768, ax * -0.1250
; Speaker 6 <-0.7071,-0.7071,0.0000>
achnlco6 sum aw *0.1768, ax *-0.0884, ay * -0.0884
; Speaker 7 <0.0000,-1.0000,0.0000>
achnlco7 sum aw *0.1768, ax * -0.1250
; Speaker 8 <0.7071,-0.7071,0.0000>
achnlco8 sum aw *0.1768, ax *0.0884, ay * -0.0884
octo2mix:
achnl1 sum achnlco1 * ieqshift, achnlsh1 * 1 - ieqshift
achnl2 sum achnlco2 * ieqshift, achnlsh2 * 1 - ieqshift
achnl3 sum achnlco3 * ieqshift, achnlsh3 * 1 - ieqshift
achnl4 sum achnlco4 * ieqshift, achnlsh4 * 1 - ieqshift
achnl5 sum achnlco5 * ieqshift, achnlsh5 * 1 - ieqshift
achnl6 sum achnlco6 * ieqshift, achnlsh6 * 1 - ieqshift
achnl7 sum achnlco7 * ieqshift, achnlsh7 * 1 - ieqshift
achnl8 sum achnlco8 * ieqshift, achnlsh8 * 1 - ieqshift
kpeak1 peak achnl1
kpeak2 peak achnl2
kpeak3 peak achnl3
kpeak4 peak achnl4
kpeak5 peak achnl5
kpeak6 peak achnl6
kpeak7 peak achnl7
kpeak8 peak achnl8
printk p3, kpeak1,0
printk p3, kpeak2,4
printk p3, kpeak3,8
printk p3, kpeak4,12
printk p3, kpeak5,16
printk p3, kpeak6,20
printk p3, kpeak7,24
printk p3, kpeak8,28
fout "$FILE.oct2dec1.$HEADER.", giformat, achnl1
fout "$FILE.oct2dec2.$HEADER.", giformat, achnl2
fout "$FILE.oct2dec3.$HEADER.", giformat, achnl3
fout "$FILE.oct2dec4.$HEADER.", giformat, achnl4
fout "$FILE.oct2dec5.$HEADER.", giformat, achnl5
fout "$FILE.oct2dec6.$HEADER.", giformat, achnl6
fout "$FILE.oct2dec7.$HEADER.", giformat, achnl7
fout "$FILE.oct2dec8.$HEADER.", giformat, achnl8
goto skipend
; ******************************************************************************************************************************
cube: ; 8chnl decode (cube),1st order (First order controlled opposites)
; ******************************************************************************************************************************
; Rig `Controlled Opposites' Decode Matrix (First Order)
; w x y z
; Speaker1 <0.5774,0.5774,-0.5774> front left lower
achnl1 sum aw *0.1768, ax *0.0722, ay *0.0722, az * -0.0722
; Speaker2 <0.5774,-0.5774,-0.5774> front right lower
achnl2 sum aw *0.1768, ax *0.0722, ay *-0.0722, az * -0.0722
; Speaker3 <-0.5774,-0.5774,-0.5774> back right lower
achnl3 sum aw *0.1768, ax *-0.0722, ay *-0.0722, az * -0.0722
; Speaker4 <-0.5774,0.5774,-0.5774> back left lower
achnl4 sum aw *0.1768, ax *-0.0722, ay *0.0722, az * -0.0722
; Speaker5 <0.5774,0.5774,0.5774> front left upper
achnl5 sum aw *0.1768, ax *0.0722, ay *0.0722, az * 0.0722
; Speaker6 <0.5774,-0.5774,0.5774> front right upper
achnl6 sum aw *0.1768, ax *0.0722, ay *-0.0722, az * 0.0722
; Speaker7 <-0.5774,-0.5774,0.5774> back right upper
achnl7 sum aw *0.1768, ax *-0.0722, ay *-0.0722, az * 0.0722
; Speaker8 <-0.5774,0.5774,0.5774> back left upper
achnl8 sum aw *0.1768, ax *-0.0722, ay *0.0722, az * 0.0722
kpeak1 peak achnl1
kpeak2 peak achnl2
kpeak3 peak achnl3
kpeak4 peak achnl4
kpeak5 peak achnl5
kpeak6 peak achnl6
kpeak7 peak achnl7
kpeak8 peak achnl8
printk p3, kpeak1,0
printk p3, kpeak2,4
printk p3, kpeak3,8
printk p3, kpeak4,12
printk p3, kpeak5,16
printk p3, kpeak6,20
printk p3, kpeak7,24
printk p3, kpeak8,28
;outo achnl1, achnl2, achnl3, achnl4, achnl5, achnl6, achnl7, achnl8 ;output for writing on Disk or Dat
fout "$FILE.cubedec1.$HEADER.", giformat, achnl1
fout "$FILE.cubedec2.$HEADER.", giformat, achnl2
fout "$FILE.cubedec3.$HEADER.", giformat, achnl3
fout "$FILE.cubedec4.$HEADER.", giformat, achnl4
fout "$FILE.cubedec5.$HEADER.", giformat, achnl5
fout "$FILE.cubedec6.$HEADER.", giformat, achnl6
fout "$FILE.cubedec7.$HEADER.", giformat, achnl7
fout "$FILE.cubedec8.$HEADER.", giformat, achnl8
goto skipend
; ******************************************************************************************************************************
dodecahedron1:
; ******************************************************************************************************************************
; Rig Decode Matrix to Reproduce Spherical Harmonics (First Order)
; This rig configuration produces a strict idealised response that satisfies the Ambisonic matching equations.
; Generally this type of configuration produces a relatively small stable listening area. (See controlled opposites below.)
achnlsh1 init 0
achnlsh2 init 0
achnlsh3 init 0
achnlsh4 init 0
achnlsh5 init 0
achnlsh6 init 0
achnlsh7 init 0
achnlsh8 init 0
achnlsh9 init 0
achnlsh10 init 0
achnlsh11 init 0
achnlsh12 init 0
achnlco1 init 0
achnlco2 init 0
achnlco3 init 0
achnlco4 init 0
achnlco5 init 0
achnlco6 init 0
achnlco7 init 0
achnlco8 init 0
achnlco9 init 0
achnlco10 init 0
achnlco11 init 0
achnlco12 init 0
if ieqshift = 1 goto dodec1controlled
; w x y z
; Speaker 1 <0.0000,0.0000,1.0000>
achnlsh1 sum aw * 0.1179, az * 0.2500
; Speaker 2 <0.0000,0.0000,-1.0000>
achnlsh2 sum aw * 0.1179, az * -0.2500
; Speaker 3 <0.7236,0.5257,0.4472>
achnlsh3 sum aw *0.1179, ax *0.1809, ay *0.1314, az * 0.1118
; Speaker 4 <-0.7236,-0.5257,-0.4472>
achnlsh4 sum aw *0.1179, ax *-0.1809, ay *-0.1314, az * -0.1118
; Speaker 5 <0.7236,-0.5257,0.4472>
achnlsh5 sum aw *0.1179, ax *0.1809, ay *-0.1314, az * 0.1118
; Speaker 6 <-0.7236,0.5257,-0.4472>
achnlsh6 sum aw *0.1179, ax *-0.1809, ay *0.1314, az * -0.1118
; Speaker 7 <-0.2764,0.8507,0.4472>
achnlsh7 sum aw *0.1179, ax *-0.0691, ay *0.2127, az * 0.1118
; Speaker 8 <0.2764,-0.8507,-0.4472>
achnlsh8 sum aw *0.1179, ax * 0.0691, ay *-0.2127, az * -0.1118
; Speaker 9 <-0.2764,-0.8507,0.4472>
achnlsh9 sum aw *0.1179, ax *-0.0691, ay *-0.2127, az * 0.1118
; Speaker 10 <0.2764,0.8507,-0.4472>
achnlsh10 sum aw *0.1179, ax *0.0691, ay *0.2127, az * -0.1118
; Speaker 11 <-0.8944,0.0000,0.4472>
achnlsh11 sum aw *0.1179, ax * -0.2236, az * 0.1118
; Speaker 12 <0.8944,0.0000,-0.4472>
achnlsh12 sum aw *0.1179, ax * 0.2236, az * -0.1118
if ieqshift = 0 goto dodec1mix
dodec1controlled:
;Rig `Controlled Opposites' Decode Matrix (First Order)
;This rig configuration produces an `in-phase' response and each speaker will have only a single maximum given a moving virtual sound source.
; w x y z
; Speaker 1 <0.0000,0.0000,1.0000>
achnlco1 sum aw * 0.1179, az * 0.0833
; Speaker 2 <0.0000,0.0000,-1.0000>
achnlco2 sum aw * 0.1179, az * -0.0833
; Speaker 3 <0.7236,0.5257,0.4472>
achnlco3 sum aw *0.1179, ax *0.0603, ay *0.0438, az * 0.0373
; Speaker 4 <-0.7236,-0.5257,-0.4472>
achnlco4 sum aw *0.1179, ax *-0.0603, ay *-0.0438, az * -0.0373
; Speaker 5 <0.7236,-0.5257,0.4472>
achnlco5 sum aw *0.1179, ax *0.0603, ay *-0.0438,az * 0.0373
; Speaker 6 <-0.7236,0.5257,-0.4472>
achnlco6 sum aw *0.1179, ax *-0.0603, ay *0.0438, az * -0.0373
; Speaker 7 <-0.2764,0.8507,0.4472>
achnlco7 sum aw *0.1179, ax *-0.0230, ay *0.0709, az * 0.0373
; Speaker 8 <0.2764,-0.8507,-0.4472>
achnlco8 sum aw *0.1179, ax *0.0230, ay *-0.0709,az * -0.0373
; Speaker 9 <-0.2764,-0.8507,0.4472>
achnlco9 sum aw *0.1179, ax *-0.0230, ay *-0.0709,az * 0.0373
; Speaker 10 <0.2764,0.8507,-0.4472>
achnlco10 sum aw *0.1179, ax *0.0230, ay *0.0709, az * -0.0373
; Speaker 11 <-0.8944,0.0000,0.4472>
achnlco11 sum aw *0.1179, ax * -0.0745, az * 0.0373
; Speaker 12 <0.8944,0.0000,-0.4472>
achnlco12 sum aw *0.1179, ax * 0.0745, az * -0.0373
dodec1mix:
achnl1 sum achnlco1 * ieqshift, achnlsh1 * 1 - ieqshift
achnl2 sum achnlco2 * ieqshift, achnlsh2 * 1 - ieqshift
achnl3 sum achnlco3 * ieqshift, achnlsh3 * 1 - ieqshift
achnl4 sum achnlco4 * ieqshift, achnlsh4 * 1 - ieqshift
achnl5 sum achnlco5 * ieqshift, achnlsh5 * 1 - ieqshift
achnl6 sum achnlco6 * ieqshift, achnlsh6 * 1 - ieqshift
achnl7 sum achnlco7 * ieqshift, achnlsh7 * 1 - ieqshift
achnl8 sum achnlco8 * ieqshift, achnlsh8 * 1 - ieqshift
achnl9 sum achnlco9 * ieqshift, achnlsh9 * 1 - ieqshift
achnl10 sum achnlco10 * ieqshift, achnlsh10 * 1 - ieqshift
achnl11 sum achnlco11 * ieqshift, achnlsh11 * 1 - ieqshift
achnl12 sum achnlco12 * ieqshift, achnlsh12 * 1 - ieqshift
kpeak1 peak achnl1
kpeak2 peak achnl2
kpeak3 peak achnl3
kpeak4 peak achnl4
kpeak5 peak achnl5
kpeak6 peak achnl6
kpeak7 peak achnl7
kpeak8 peak achnl8
kpeak9 peak achnl9
kpeak10 peak achnl10
kpeak11 peak achnl11
kpeak12 peak achnl12
printk p3, kpeak1,0
printk p3, kpeak2,3
printk p3, kpeak3,6
printk p3, kpeak4,9
printk p3, kpeak5,12
printk p3, kpeak6,15
printk p3, kpeak7,18
printk p3, kpeak8,21
printk p3, kpeak9,24
printk p3, kpeak10,27
printk p3, kpeak11,30
printk p3, kpeak12,33
; soundout achnl1, "$FILE.dec1.$HEADER.",giformat
; soundout achnl2, "$FILE.dec2.$HEADER.",giformat
; soundout achnl3, "$FILE.dec3.$HEADER.",giformat
; soundout achnl4, "$FILE.dec4.$HEADER.",giformat
; soundout achnl5, "$FILE.dec5.$HEADER.",giformat
; soundout achnl6, "$FILE.dec6.$HEADER.",giformat
; soundout achnl7, "$FILE.dec7.$HEADER.",giformat
; soundout achnl8, "$FILE.dec8.$HEADER.",giformat
; soundout achnl9, "$FILE.dec9.$HEADER.",giformat
; soundout achnl10, "$FILE.dec10.$HEADER.",giformat
; soundout achnl11, "$FILE.dec11.$HEADER.",giformat
; soundout achnl12, "$FILE.dec12.$HEADER.",giformat
fout "$FILE.do1dec1.$HEADER.", giformat, achnl1
fout "$FILE.do1dec2.$HEADER.", giformat, achnl2
fout "$FILE.do1dec3.$HEADER.", giformat, achnl3
fout "$FILE.do1dec4.$HEADER.", giformat, achnl4
fout "$FILE.do1dec5.$HEADER.", giformat, achnl5
fout "$FILE.do1dec6.$HEADER.", giformat, achnl6
fout "$FILE.do1dec7.$HEADER.", giformat, achnl7
fout "$FILE.do1dec8.$HEADER.", giformat, achnl8
fout "$FILE.do1dec9.$HEADER.", giformat, achnl9
fout "$FILE.do1dec10.$HEADER.", giformat, achnl10
fout "$FILE.do1dec11.$HEADER.", giformat, achnl11
fout "$FILE.do1dec12.$HEADER.", giformat, achnl12
goto skipend
; ******************************************************************************************************************************
dodecahedron2:
; ******************************************************************************************************************************
; Rig Decode Matrix to Reproduce Spherical Harmonics (First Order)
; This rig configuration produces a strict idealised response that satisfies the Ambisonic matching equations.
; Generally this type of configuration produces a relatively small stable listening area. (See controlled opposites below.)
achnlsh1 init 0
achnlsh2 init 0
achnlsh3 init 0
achnlsh4 init 0
achnlsh5 init 0
achnlsh6 init 0
achnlsh7 init 0
achnlsh8 init 0
achnlsh9 init 0
achnlsh10 init 0
achnlsh11 init 0
achnlsh12 init 0
achnlco1 init 0
achnlco2 init 0
achnlco3 init 0
achnlco4 init 0
achnlco5 init 0
achnlco6 init 0
achnlco7 init 0
achnlco8 init 0
achnlco9 init 0
achnlco10 init 0
achnlco11 init 0
achnlco12 init 0
if ieqshift = 1 goto dodec2controlled
; w x y z
; Speaker 1 <0.0000,0.0000,1.0000>
achnlsh1 sum aw *0.1179, ax * 0.2500
; Speaker 2 <-1.0000,0.0000,0.0000>
achnlsh2 sum aw *0.1179, ax * -0.2500
; Speaker 3 <0.4472,0.0000,-0.8944>
achnlsh3 sum aw *0.1179, ax * 0.1118, az * -0.2236
; Speaker 4 <-0.4472,0.0000,0.8944>
achnlsh4 sum aw *0.1179, ax * -0.1118, az * 0.2236
; Speaker 5 <0.4472,0.8507,-0.2764>
achnlsh5 sum aw *0.1179, ax *0.1118, ay *0.2127, az * -0.0691
; Speaker 6 <-0.4472,-0.8507,0.2764>
achnlsh6 sum aw *0.1179, ax *-0.1118, ay *-0.2127, az * 0.0691
; Speaker 7 <0.4472,-0.8507,-0.2764>
achnlsh7 sum aw *0.1179, ax *0.1118, ay *-0.2127, az * -0.0691
; Speaker 8 <-0.4472,0.8507,0.2764>
achnlsh8 sum aw *0.1179, ax *-0.1118, ay *0.2127, az * 0.0691
; Speaker 9 <0.4472,0.5257,0.7236>
achnlsh9 sum aw *0.1179, ax *0.1118, ay *0.1314, az * 0.1809
; Speaker 10 <-0.4472,-0.5257,-0.7236>
achnlsh10 sum aw *0.1179, ax *-0.1118, ay *-0.1314, az *-0.1809
; Speaker 11 <0.4472,-0.5257,0.7236>
achnlsh11 sum aw *0.1179, ax *0.1118, ay * -0.1314, az * 0.1809
; Speaker 12 <-0.4472,0.5257,-0.7236>
achnlsh12 sum aw *0.1179, ax *-0.1118, ay *0.1314, az * -0.1809
if ieqshift = 0 goto dodec2mix
dodec2controlled:
; Rig `Controlled Opposites' Decode Matrix (First Order)
; This rig configuration produces an `in-phase' response and each speaker will have only a single maximum given a moving virtual sound source.
; w x y z
; Speaker 1 <1.0000,0.0000,0.0000>
achnlco1 sum aw *0.1179, ax * 0.0833
; Speaker 2 <-1.0000,0.0000,0.0000>
achnlco2 sum aw *0.1179, ax * -0.0833
; Speaker 3 <0.4472,0.0000,-0.8944>
achnlco3 sum aw *0.1179, ax * 0.0373, az * -0.0745
; Speaker 4 <-0.4472,0.0000,0.8944>
achnlco4 sum aw *0.1179, ax * -0.0373, az * 0.0745
; Speaker 5 <0.4472,0.8507,-0.2764>
achnlco5 sum aw *0.1179, ax *0.0373, ay *0.0709, az * -0.0230
; Speaker 6 <-0.4472,-0.8507,0.2764>
achnlco6 sum aw *0.1179, ax *-0.0373, ay *-0.0709, az * 0.0230
; Speaker 7 <0.4472,-0.8507,-0.2764>
achnlco7 sum aw *0.1179, ax *0.0373, ay *-0.0709, az * -0.0230
; Speaker 8 <-0.4472,0.8507,0.2764>
achnlco8 sum aw *0.1179, ax *-0.0373, ay *0.0709, az * 0.0230
; Speaker 9 <0.4472,0.5257,0.7236>
achnlco9 sum aw *0.1179, ax *0.0373, ay *0.0438, az * 0.0603
; Speaker 10 <-0.4472,-0.5257,-0.7236>
achnlco10 sum aw *0.1179, ax *-0.0373, ay *-0.0438, az * -0.0603
; Speaker 11 <0.4472,-0.5257,0.7236>
achnlco11 sum aw *0.1179, ax *0.0373, ay *-0.0438, az * 0.0603
; Speaker 12 <-0.4472,0.5257,-0.7236>
achnlco12 sum aw *0.1179, ax *-0.0373, ay *0.0438, az * -0.0603
dodec2mix:
achnl1 sum achnlco1 * ieqshift, achnlsh1 * 1 - ieqshift
achnl2 sum achnlco2 * ieqshift, achnlsh2 * 1 - ieqshift
achnl3 sum achnlco3 * ieqshift, achnlsh3 * 1 - ieqshift
achnl4 sum achnlco4 * ieqshift, achnlsh4 * 1 - ieqshift
achnl5 sum achnlco5 * ieqshift, achnlsh5 * 1 - ieqshift
achnl6 sum achnlco6 * ieqshift, achnlsh6 * 1 - ieqshift
achnl7 sum achnlco7 * ieqshift, achnlsh7 * 1 - ieqshift
achnl8 sum achnlco8 * ieqshift, achnlsh8 * 1 - ieqshift
achnl9 sum achnlco9 * ieqshift, achnlsh9 * 1 - ieqshift
achnl10 sum achnlco10 * ieqshift, achnlsh10 * 1 - ieqshift
achnl11 sum achnlco11 * ieqshift, achnlsh11 * 1 - ieqshift
achnl12 sum achnlco12 * ieqshift, achnlsh12 * 1 - ieqshift
kpeak1 peak achnl1
kpeak2 peak achnl2
kpeak3 peak achnl3
kpeak4 peak achnl4
kpeak5 peak achnl5
kpeak6 peak achnl6
kpeak7 peak achnl7
kpeak8 peak achnl8
kpeak9 peak achnl9
kpeak10 peak achnl10
kpeak11 peak achnl11
kpeak12 peak achnl12
printk p3, kpeak1,0
printk p3, kpeak2,3
printk p3, kpeak3,6
printk p3, kpeak4,9
printk p3, kpeak5,12
printk p3, kpeak6,15
printk p3, kpeak7,18
printk p3, kpeak8,21
printk p3, kpeak9,24
printk p3, kpeak10,27
printk p3, kpeak11,30
printk p3, kpeak12,33
; soundout achnl1, "$FILE.dec1.$HEADER.", giformat
; soundout achnl2, "$FILE.dec2.$HEADER.", giformat
; soundout achnl3, "$FILE.dec3.$HEADER.", giformat
; soundout achnl4, "$FILE.dec4.$HEADER.", giformat
; soundout achnl5, "$FILE.dec5.$HEADER.", giformat
; soundout achnl6, "$FILE.dec6.$HEADER.", giformat
; soundout achnl7, "$FILE.dec7.$HEADER.", giformat
; soundout achnl8, "$FILE.dec8.$HEADER.", giformat
; soundout achnl9, "$FILE.dec9.$HEADER.", giformat
; soundout achnl10, "$FILE.dec10.$HEADER.", giformat
; soundout achnl11, "$FILE.dec11.$HEADER.", giformat
; soundout achnl12, "$FILE.dec12.$HEADER.", giformat
fout "$FILE.do2dec1.$HEADER.", giformat, achnl1
fout "$FILE.do2dec2.$HEADER.", giformat, achnl2
fout "$FILE.do2dec3.$HEADER.", giformat, achnl3
fout "$FILE.do2dec4.$HEADER.", giformat, achnl4
fout "$FILE.do2dec5.$HEADER.", giformat, achnl5
fout "$FILE.do2dec6.$HEADER.", giformat, achnl6
fout "$FILE.do2dec7.$HEADER.", giformat, achnl7
fout "$FILE.do2dec8.$HEADER.", giformat, achnl8
fout "$FILE.do2dec9.$HEADER.", giformat, achnl9
fout "$FILE.do2dec10.$HEADER.", giformat, achnl10
fout "$FILE.do2dec11.$HEADER.", giformat, achnl11
fout "$FILE.do2dec12.$HEADER.", giformat, achnl12
skipend:
endin
#define FILE #Oscillating-# ;insert filename here
#define HEADER #aif# ;insert filetype here
/*instr 81 9-CHNL DECODING UNIT, 2nd ORDER AMBISONICS */
i81 0 35 1
e
e
/*instr 40 x,y,z -READER */
/*instr 42 x, y, z -CONVERTER*/
/*instr 46 A,E,D - MOVEMENT SCORE READER*/
/*instr 47 AED- MODULATOR*/
/*instr 48 AED RANDOMIZER*/
/*instr 50 SOUNDFILE READER*/
/*instr 60 LOCAL ( TRACK APPLIED) REVERB*/
/*instr 66 GLOBAL REVERB ( W- CHANNEL APPLIED)*/
/*instr 70 HRTF ENCODE+IID+ITD*/
/*instr 71 READING, MIXING, OUTPUT*/
/*instr 72 9-CHNL ENCODING UNIT, 2nd ORDER AMBISONICS*/
/*instr 73 MIXING, OUTPUT & 9-CHNL DECODING UNIT, 2nd ORDER AMBISONICS */
Version: 3
Render: Real
Ask: Yes
Functions: Window
Listing: Window
WindowBounds: 68 204 960 1049
CurrentView: orc
IOViewEdit: On
Options: -b128 -A -s -m167 -R --midi-velocity-amp=4 --midi-key-cps=5
ioView nobackground {65535, 65535, 65535}