René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

spat3di (Csound opcode)

Positions the input sound in a 3D space with the sound source position set at i-time.
aW, aX, aY, aZ spat3di ain, iX, iY, iZ, idist, ift, imode [, istor]
sr     = 44100
kr     = 4410
nchnls = 2

instr 1
  ilen =        p3
  p3   = p3+0.3
  iamp =        p4
  ifrq = cpsoct(p5)

  ix   =        p6
  iy   =        p7
  iz   =        p8

  kamp linseg   0, 0.02, iamp, ilen-0.04, iamp, 0.02, 0

  ain  oscili kamp, ifrq, 1

  aW, aX, aY, aZ spat3di ain, ix, iy, iz, 1, 2, 4


aW      butterlp aW, 1000
aY      butterlp aY, 1000
aleft   =  aW + aX
aright  =  aY + aZ

    

;  a_L_, a_R_	hilbert aW		/* W */
;  a_5_	=   0.4699 * a_L_
;  a_6_	=  -0.1710 * a_R_
;
;  a_L_, a_R_	hilbert aX		/* X */
;  a_5_	=  a_5_ + 0.0928 * a_L_
;  a_6_	=  a_6_ + 0.2550 * a_R_
;
;  a_L_, a_R_	hilbert aY		/* Y */
;  a_6_	=  a_6_ + 0.3277 * a_L_
;  a_L_	delay 2.16 * (a_5_ + a_6_), 0.02
;  a_R_	delay 2.16 * (a_5_ - a_6_), 0.02
;
;  ;a_L_ = kamp

  ;outs a_L_, a_R_
  outs aleft, aright
endin
f1  0 2048 10   1   0.4   0.2

;; Room Parameters:

f2 0 64 -2	
    3 40 -1 0.003 1.0 123
		1 13.627 0.05 0.80 20000.0 0.0 0.50 2	/* ceil		*/
		1  1.753 0.05 0.80 20000.0 0.0 0.25 2	/* floor	*/
		1 11.489 0.05 0.90 20000.0 0.0 0.35 2	/* front	*/
		1  8.951 0.05 0.90 20000.0 0.0 0.35 2	/* back		*/
		1 15.287 0.05 0.92 20000.0 0.0 0.35 2	/* right	*/
		1 10.399 0.05 0.92 20000.0 0.0 0.35 2	/* left		*/


i1  0.00 0.06  10000 8.00  0.0000 1.0000 0.0000
i1  0.10 0.06  10000 8.00  0.3090 0.9511 0.0000
i1  0.20 0.06  10000 8.00  0.5878 0.8090 0.0000
i1  0.30 0.06  10000 8.00  0.8090 0.5878 0.0000
i1  0.40 0.06  10000 8.00  0.9510 0.3091 0.0000
i1  0.50 0.06  10000 8.00  1.0000 0.0000 0.0000
i1  0.60 0.06  10000 8.00  0.9511 -0.3090 0.0000
i1  0.70 0.06  10000 8.00  0.8091 -0.5877 0.0000
i1  0.80 0.06  10000 8.00  0.5878 -0.8090 0.0000
i1  0.90 0.06  10000 8.00  0.3091 -0.9510 0.0000
i1  1.00 0.06  10000 8.00  0.0001 -1.0000 0.0000
i1  1.10 0.06  10000 8.00  -0.3089 -0.9511 0.0000
i1  1.20 0.06  10000 8.00  -0.5877 -0.8091 0.0000
i1  1.30 0.06  10000 8.00  -0.8089 -0.5879 0.0000
i1  1.40 0.06  10000 8.00  -0.9510 -0.3091 0.0000
i1  1.50 0.06  10000 8.00  -1.0000 -0.0001 0.0000
i1  1.60 0.06  10000 8.00  -0.9511 0.3089 0.0000
i1  1.70 0.06  10000 8.00  -0.8091 0.5877 0.0000
i1  1.80 0.06  10000 8.00  -0.5879 0.8089 0.0000
i1  1.90 0.06  10000 8.00  -0.3092 0.9510 0.0000
i1  2.00 0.06  10000 8.00  -0.0002 1.0000 0.0000