[PD] spatialisation/convolution-related

bsaylor at macalester.edu bsaylor at macalester.edu
Wed Aug 14 22:05:53 CEST 2002


Here are a couple of abstractions I've made to simulate 2-d sound
positioning.  Used along with some reverb (such as freeverb~), they can
create cheap spatialization.

Ben

On Wed, Aug 14, 2002 at 11:42:23AM +0100, MLN Kazem, Aerospace Engineering wrote:
> Hi people,
> 
> I suppose I'm a complete newbie and therefore inevitably will ask dull
> and repeated question.. but.. I am looking to produce as near as 
> effective 3D sound in real time on a PC (windows I'm afraid). At the 
> minute I am using a sdk which sits on top of the DirectSound API which
> sounds pretty good (to me anyway) but has anything to do with HRTFs 
> been implemented in pd? I've heard of spat~ but I am presuming that 
> this is a.)max related b.)relies on external DSPs and c.)not free.
> 
> If nothing else newbies like me must at least create a little 
> amusement....
> thanks
> Mandy
> 
> ----------------------
> MLN Kazem, Aerospace Engineering
> M.Kazem at bristol.ac.uk
> Tel. 0117 9288219
> Fax. 0117 9272771
> 
> 
-------------- next part --------------
#N canvas 10 20 762 475 10;
#X obj 45 25 inlet~;
#X obj 113 431 outlet~;
#X obj 335 435 outlet~;
#X text 378 73 in dry 20 deg. C air \, sound travels at about 344 m/s
;
#X obj 251 68 pol2rec~;
#X text 503 29 a head is about 20cm wide;
#X text 521 50 = 0.1m from center to ear;
#X obj 230 29 inlet~;
#X obj 322 30 inlet~;
#X text 44 4 input;
#X text 228 9 angle;
#X text 321 8 distance;
#X text 231 73 x;
#X text 318 71 y;
#X obj 114 212 sqrt~;
#X obj 347 214 sqrt~;
#X obj 286 127 *~;
#X obj 114 172 *~;
#X obj 347 176 *~;
#X obj 114 145 +~ 0.1;
#X obj 347 151 -~ 0.1;
#X obj 114 271 *~ 1000;
#X obj 114 249 /~ 344;
#X obj 347 276 *~ 1000;
#X obj 347 254 /~ 344;
#X obj 113 409 *~;
#X obj 335 410 *~;
#X text 196 331 inverse square;
#X text 444 144 6db drop per doubling of distance?;
#X obj 147 375 clip~ 0 1;
#X obj 410 373 clip~ 0 1;
#X obj 410 347 expr~ 0.1 / pow($v1 \, 2);
#X obj 147 349 expr~ 0.1 / pow($v1 \, 2);
#N canvas 12 60 434 298 delwrite 0;
#X obj 39 64 delwrite~ \$0-d 1000;
#X obj 22 101 outlet~;
#X obj 22 22 inlet~;
#X text 13 153 delwrite~ and vd~ are put into subpatches and audio-connected
to get them sorted in the right order and thus avoid a 1 block minimum
delay.;
#X connect 2 0 0 0;
#X connect 2 0 1 0;
#X restore 45 55 pd delwrite;
#N canvas 8 40 450 300 vd-L 0;
#X obj 134 62 vd~ \$0-d;
#X obj 134 31 inlet~;
#X obj 19 28 inlet~;
#X obj 134 95 outlet~;
#X connect 0 0 3 0;
#X connect 1 0 0 0;
#X restore 62 349 pd vd-L;
#N canvas 4 20 450 300 vd-R 0;
#X obj 134 62 vd~ \$0-d;
#X obj 134 31 inlet~;
#X obj 19 28 inlet~;
#X obj 134 95 outlet~;
#X connect 0 0 3 0;
#X connect 1 0 0 0;
#X restore 335 342 pd vd-R;
#X text 416 390 otherwise level would be infinity at r=0;
#X connect 0 0 33 0;
#X connect 4 0 19 0;
#X connect 4 0 20 0;
#X connect 4 1 16 0;
#X connect 4 1 16 1;
#X connect 7 0 4 0;
#X connect 8 0 4 1;
#X connect 14 0 22 0;
#X connect 14 0 32 0;
#X connect 15 0 24 0;
#X connect 15 0 31 0;
#X connect 16 0 15 0;
#X connect 16 0 14 0;
#X connect 17 0 14 0;
#X connect 18 0 15 0;
#X connect 19 0 17 0;
#X connect 19 0 17 1;
#X connect 20 0 18 0;
#X connect 20 0 18 1;
#X connect 21 0 34 1;
#X connect 22 0 21 0;
#X connect 23 0 35 1;
#X connect 24 0 23 0;
#X connect 25 0 1 0;
#X connect 26 0 2 0;
#X connect 29 0 25 1;
#X connect 30 0 26 1;
#X connect 31 0 30 0;
#X connect 32 0 29 0;
#X connect 33 0 34 0;
#X connect 33 0 35 0;
#X connect 34 0 25 0;
#X connect 35 0 26 0;
-------------- next part --------------
#N canvas 8 40 545 422 10;
#X text 138 9 simplified point source positioning;
#X text 165 24 - just models delay between ears;
#X text 80 383 0.2 m between ears / 344 m/s speed of sound -> 0.6 ms
delay for now;
#X obj 61 95 inlet~;
#X obj 193 96 inlet~;
#X obj 67 237 vdelay~;
#X obj 172 233 vdelay~;
#X obj 79 325 outlet~;
#X obj 155 326 outlet~;
#X text 194 78 difference;
#X obj 245 169 *~ -0.6;
#X text 165 40 - direct left is -1 \, direct right is 1;
#X obj 147 168 *~ 0.6;
#X obj 245 144 clip~ -99 0;
#X obj 147 143 clip~ 0 99;
#X connect 3 0 5 0;
#X connect 3 0 6 0;
#X connect 4 0 13 0;
#X connect 4 0 14 0;
#X connect 5 0 7 0;
#X connect 6 0 8 0;
#X connect 10 0 6 1;
#X connect 12 0 5 1;
#X connect 13 0 10 0;
#X connect 14 0 12 0;
-------------- next part --------------
#N canvas 153 195 450 300 10;
#X obj 40 42 inlet~;
#X obj 39 224 outlet~;
#X obj 117 42 inlet~;
#X text 40 18 audio;
#X text 115 20 delay time;
#N canvas 8 40 450 300 write 0;
#X obj 58 79 inlet~;
#X obj 44 218 outlet~;
#X obj 79 121 delwrite~ \$0-d 200;
#X connect 0 0 1 0;
#X connect 0 0 2 0;
#X restore 15 101 pd write;
#N canvas 124 138 450 300 mix 0;
#X obj 57 269 outlet~;
#X obj 94 108 inlet~;
#X obj 63 199 vd~ \$0-d;
#X obj 32 108 inlet~;
#X obj 18 223 *~ 0;
#X connect 1 0 2 0;
#X connect 2 0 0 0;
#X connect 3 0 4 0;
#X connect 4 0 0 0;
#X restore 39 150 pd mix;
#X connect 0 0 5 0;
#X connect 2 0 6 1;
#X connect 5 0 6 0;
#X connect 6 0 1 0;


More information about the Pd-list mailing list