max v2; #N vpatcher 77 34 1259 689; #P origin -11 21; #P button 19 22 15 0; #P window setfont "Sans Serif" 9.; #P newex 837 214 42 9109513 sig~ 600; #P newex 837 189 34 9109513 begin~; #P newex 785 209 32 9109513 sig~ 2; #P newex 786 188 34 9109513 begin~; #P message 937 147 40 9109513 select 3; #P user ezadc~ 937 320 981 353 0; #P user umenu 647 130 100 9109543 1 32 146 1; #X add No Sound; #X add Siren Sound; #X add File Sound; #X add Audio In; #P comment 361 442 78 9109513 More amplitude scaling based on left/right panning; #P comment 530 361 109 9109513 Amplitude scaling based on distance from source; #P comment 334 264 200 9109513 Distance between right ear and sound source; #P newex 775 354 53 9109513 selector~ 3; #P newex 501 483 27 9109513 *~; #P newex 450 445 62 9109513 expr (500 + $f1) / 1000.; #P newex 13 495 27 9109513 *~; #P newex 56 450 72 9109513 expr (500 - $f1) / 1000.; #P number 281 477 35 9 600 40000 7 139 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 476 514 17 9109513 -; #P newex 38 529 19 9109513 -; #P flonum 282 527 35 9 0.1 0.5 7 139 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 527 579 40 9109513 lores~; #P newex 14 578 40 9109513 lores~; #P newex 534 394 99 9109513 expr (500 - $f1) / 500.; #P newex 13 398 99 9109513 expr (500 - $f1) / 500.; #P user ezdac~ 277 597 321 630 0; #P newex 518 429 27 9109513 *~; #P newex 13 436 27 9109513 *~; #P newex 535 315 55 9109513 if $f1 > 500 then 500 else $f1; #P newex 12 320 53 9109513 if $f1 > 500 then 500 else $f1; #P newex 837 244 53 9109513 cycle~ 600; #P newex 789 278 30 9109513 +~ 15; #P newex 789 254 29 9109513 *~ 15; #P newex 789 302 38 9109513 tapout~; #P newex 836 270 50 9109513 tapin~ 500; #P newex 787 231 43 9109513 cycle~ 2; #P window setfont "Times New Roman" 10.; #P comment 1013 80 88 9175050 when metro is stopped \, stop the soundfile playback also; #P comment 845 23 146 9175050 on/off to play the sound repeatedly by triggering it with a metronome; #P window setfont "Fixedwidth Serif" 10.; #P newex 1003 58 53 9240586 select 0; #P toggle 829 24 15 0; #P window setfont "Times New Roman" 10.; #P comment 814 119 155 9175050 initial default rate of once per second; #P comment 886 57 110 9175050 triggering interval \, in ms; #P window setfont "Fixedwidth Serif" 10.; #P number 888 74 50 10 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0; #P window setfont "Times New Roman" 10.; #P comment 1041 154 100 9175050 first you must open a soundfile from disk; #P window setfont "Fixedwidth Serif" 10.; #P message 1066 180 33 9240586 open; #P window setfont "Times New Roman" 10.; #P comment 981 175 46 9175050 start/stop; #P window setfont "Fixedwidth Serif" 10.; #P newex 829 93 69 9240586 metro 1000; #P message 1003 189 14 9240586 0; #P message 987 189 14 9240586 1; #N sfplay~ 1 120960 0 ; #P newobj 986 240 51 9240586 sfplay~; #P window setfont "Times New Roman" 10.; #P comment 1040 235 100 9175050 plays the first channel of a soundfile from disk; #P window setfont "Sans Serif" 9.; #P newex 391 394 36 9109513 tapout~; #P newex 137 394 39 9109513 tapout~; #P newex 790 324 32 9109513 *~ 0.5; #P newex 268 374 54 9109513 tapin~ 2000; #P newex 391 340 27 9109513 line~; #P message 391 312 34 9109513 \$1 100; #P newex 138 342 57 9109513 line~; #P message 138 314 34 9109513 \$1 100; #P newex 391 281 99 9109513 expr 1000 * $f1 / 340.; #P newex 138 285 99 9109513 expr 1000 * $f1 / 340.; #P message 19 44 23 9109513 500; #P message 282 88 34 9109513 size \$1; #P newex 354 62 27 9109513 !- 0; #P message 354 86 34 9109513 min \$1; #P newex 19 121 44 9109513 pack 0 0.; #P message 94 121 38 9109513 0 \, \$1 \$2; #P flonum 134 65 35 9 1. 1000. 7 139 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 53 96 91 9109513 expr 3600 * $i1 / $i2; #P newex 19 68 64 9109513 expr 1 + 2*$i1; #P newex 164 121 40 9109513 line; #P user hslider 354 114 35 232 1001 1 -500 3; #P flonum 283 191 35 9 1. 10. 7 139 0 0 0 221 221 221 222 222 222 0 0 0; #P flonum 535 207 35 9 0 0 32 139 0 0 0 221 221 221 222 222 222 0 0 0; #P flonum 284 216 35 9 5. 100. 7 139 0 0 0 221 221 221 222 222 222 0 0 0; #P flonum 13 209 35 9 0 0 32 139 0 0 0 221 221 221 222 222 222 0 0 0; #P flonum 282 162 35 9 0 0 32 139 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 535 178 27 9109513 +; #P newex 13 178 27 9109513 -; #P flonum 535 265 35 9 0 0 32 139 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 535 232 114 9109513 expr sqrt($i1*$i1+ $i2*$i2); #P flonum 11 269 35 9 0 0 32 139 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 13 232 114 9109513 expr sqrt($i1*$i1+ $i2*$i2); #P comment 42 44 213 9109513 Sound Source starts this distance away in meters; #P comment 168 65 100 9109513 kilometers per hour; #P window setfont "Sans Serif" 14.; #P comment 39 21 475 9109518 PRESS HERE TO START THE MOVING SOUND (FROM LEFT TO RIGHT); #B color 7; #P window setfont "Sans Serif" 9.; #P comment 145 93 100 9109513 Conversion to total milliseconds needed; #P comment 752 159 175 9109513 This is my siren sound \, made by a delay technique similar to doppler shift; #P comment 321 160 178 9109513 Distance of source from person; #P comment 319 185 187 9109513 1/2 the distance between left and right ears (in meters) \, exaggerated a bit for effect; #P comment 319 216 165 9109513 Distance between ears and the line where the sound is travelling; #P comment 50 268 201 9109513 Distance between left ear and sound source; #P comment 129 235 100 9109513 Pythagorean Theorem; #P comment 237 281 157 9109513 Conversion from meters to milliseconds \, using speed of sound; #P comment 240 318 136 9109513 Smoothing the varying delay time and turning it into a signal (to produce doppler shift); #P comment 11 369 109 9109513 Amplitude scaling based on distance from source; #P comment 448 80 81 9109513 Halfway point; #P comment 130 445 80 9109513 More amplitude scaling based on left/right panning; #P comment 250 451 100 9109513 Cutoff Frequency for Low-Pass filter; #P comment 251 502 100 9109513 Resonance parameter for Low-Pass filter; #P comment 471 97 22 9109513 V; #P window setfont "Sans Serif" 20.; #P comment 757 433 210 9109524 Doppler Shift in Stereo; #B color 12; #P window setfont "Sans Serif" 9.; #P comment 987 266 153 9109513 This section of the patch taken from Professor Dobrian's constantpowerpanning example; #P comment 663 531 424 9109513 User Notes: 1.To turn on sound \, click on speaker (ezdac) button and select a sound type. 2. Start the moving sound source by pressing on the upper-left toggle button. 3. One can also use the slider to simulate the movement of the siren from left to right or from right to left. 4. If the sound source is moving too slowly \, jog the 'kilometers per hour' float box. This will cause the source to move faster. 5. One can load a sound file in the upper right hand corner of the patch. 6. User modifiable parameters are in bold. 7. If sound source is not from a file \, make sure to turn off the file sound toggle for CPU performance reasons. 8. 'Jog' each of the bolded parameters \, since sometimes these parameters are initialized by Max to zero (without being reflected in the number boxes).; #P window setfont "Sans Serif" 14.; #P comment 195 577 228 9109518 PRESS THIS TO HEAR SOUND!; #B color 7; #P comment 614 104 178 9109518 SELECT SOUND SOURCE:; #B color 7; #P comment 756 462 216 9109518 By Arthur Asuncion (ICS 180); #B color 12; #P connect 24 0 25 0; #P connect 25 0 77 0; #P connect 30 0 28 0; #P connect 28 0 31 0; #P connect 31 0 24 0; #P connect 77 0 82 0; #P connect 82 0 79 0; #P connect 79 0 91 0; #P connect 91 0 84 0; #P connect 105 0 45 0; #P connect 45 0 37 0; #P connect 37 0 41 0; #P connect 87 0 84 1; #P connect 34 0 28 1; #P connect 54 0 79 1; #P connect 90 0 91 1; #P connect 89 0 87 0; #P connect 86 0 84 2; #P connect 25 0 87 1; #P connect 37 0 38 0; #P connect 38 0 41 1; #P connect 31 0 90 0; #P connect 41 0 40 0; #P connect 32 0 24 1; #P connect 39 0 38 1; #P connect 52 0 54 0; #P connect 49 0 54 0; #P connect 25 0 46 0; #P connect 46 0 48 0; #P connect 48 0 49 0; #P connect 40 0 36 0; #P connect 94 0 52 0; #P connect 84 0 81 0; #P connect 37 0 44 0; #P connect 35 0 30 0; #P connect 85 0 81 1; #P connect 45 0 43 0; #P connect 43 0 42 0; #P connect 42 0 35 0; #P connect 44 0 35 0; #P connect 36 0 35 0; #P connect 27 0 47 0; #P connect 47 0 50 0; #P connect 50 0 51 0; #P connect 51 0 55 0; #P connect 52 0 55 0; #P connect 33 0 92 0; #P connect 89 0 88 0; #P connect 27 0 88 1; #P connect 92 0 93 0; #P connect 55 0 80 0; #P connect 80 0 93 1; #P connect 93 0 85 0; #P connect 78 0 83 0; #P connect 30 0 29 0; #P connect 29 0 33 0; #P connect 33 0 26 0; #P connect 26 0 27 0; #P connect 27 0 78 0; #P connect 83 0 80 1; #P connect 88 0 85 1; #P connect 34 0 29 1; #P connect 86 0 85 2; #P connect 32 0 26 1; #P connect 98 0 94 0; #P connect 101 0 102 0; #P connect 102 0 71 0; #P connect 71 0 74 0; #P connect 74 0 75 0; #P connect 72 0 73 0; #P connect 75 0 73 0; #P connect 53 0 94 1; #P connect 73 0 53 0; #P connect 57 0 94 2; #P connect 99 0 94 3; #P connect 67 0 60 0; #P connect 76 0 72 0; #P connect 103 0 104 0; #P connect 104 0 76 0; #P connect 64 0 60 1; #P connect 98 0 100 0; #P connect 100 0 99 0; #P connect 58 0 57 0; #P connect 62 0 57 0; #P connect 59 0 57 0; #P fasten 60 0 58 0 834 122 992 122; #P fasten 67 0 68 0 834 38 1008 38; #P connect 68 0 59 0; #P pop;