Forums > MaxMSP

Event timing problem

January 1, 2009 | 9:49 pm

Hello all Happy New Year! I’ve been trying something out using the MSP Tutorial patch on MIDI Panning as a departure. I am using two Graphic Function Editors to control the envelope of a noise source and also the panning of the noise as it’s played. The note and corresponding panning are both triggered by a single bang. Heres the problem. Say I have a sound travel from all the way left to all the way right over the course of it’s duration. When triggered again the sound will start in the right channel for a brief instant before going back to the left channel to repeat. How do I get the sound and the panning to start at the same time? I’ve tried rearranging the Left to Right orientation of elements in my patch to see if it’s got something to do with event order in Max but so far that hasn’t seemed to make a difference. Any help you could give is very appreciated. Thank you very much in advance.

-B


January 1, 2009 | 10:18 pm

also HAPPY NEW YEAR

It would be good to post your patch.

Anyway. Do you use trigger (or t) to make sure that you know the order in which events are occurring in stead of relying on right to left order?

Best, Hans.


January 1, 2009 | 10:37 pm

Sorry, I thought that uploading the patch as an attachment would work.

Here is the text. Thanks!

max v2;
#N vpatcher 185 44 1070 839;
#P window setfont "Sans Serif" 9.;
#P message 508 369 14 196617 1;
#P newex 508 351 24 196617 r lb;
#P comment 484 161 31 196617 Right;
#P message 503 50 34 196617 1000;
#P newex 503 32 24 196617 r lb;
#P message 300 500 23 196617 0.1;
#P newex 300 478 24 196617 r lb;
#P newex 655 262 24 196617 r lb;
#P newex 747 436 24 196617 s lb;
#P newex 552 129 41 196617 r start;
#P newex 285 129 41 196617 r start;
#P newex 104 148 41 196617 s start;
#P toggle 616 264 15 0;
#P newex 616 285 46 196617 metro 2;
#P number 581 329 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 579 307 55 196617 snapshot~;
#P message 516 129 33 196617 clear;
#P message 245 129 33 196617 clear;
#P newex 581 349 33 196617 s pan;
#P user function 516 157 716 257 1 1 0 0;
#X frgb 0 0 0;
#X brgb 202 221 126;
#X rgb2 0 0 0;
#X rgb3 255 255 255;
#X rgb4 0 0 0;
#X rgb5 0 0 0;
#X add 0. 0. 0;
#X add 1000. 127. 0;
#X domain 1000.;
#X range 0. 127.;
#X done;
#P newex 323 268 32 196617 line~;
#P newex 582 409 33 196617 r pan;
#P newex 579 264 32 196617 line~;
#P button 104 76 66 0;
#P window setfont Times 14.;
#P comment 442 44 57 1310734 Duration;
#P window setfont "Fixedwidth Serif" 10.;
#P message 441 92 80 1441802 setdomain $1;
#P flonum 441 66 60 10 0. 0 1 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont "Sans Serif" 9.;
#P newex 281 336 41 196617 *~ 0.2;
#P window setfont "Sans Serif" 12.;
#P comment 589 106 62 196620 Panning;
#P user function 260 158 460 258 1 1 0 0;
#X frgb 0 0 0;
#X brgb 202 221 126;
#X rgb2 0 0 0;
#X rgb3 255 255 255;
#X rgb4 0 0 0;
#X rgb5 0 0 0;
#X add 0. 0. 0;
#X add 10.638302 1. 0;
#X add 994.682007 1. 0;
#X add 1000. 0. 0;
#X domain 1000.;
#X range 0. 1.;
#X done;
#P window setfont "Sans Serif" 9.;
#P newex 281 670 31 196617 dac~;
#P message 506 653 27 196617 stop;
#P message 436 652 65 196617 startwindow;
#P comment 439 638 75 196617 • start audio;
#P user panel 424 632 123 43;
#X brgb 255 255 255;
#X frgb 100 202 30;
#X border 2;
#X rounded 0;
#X shadow 0;
#X done;
#P newex 281 311 39 196617 noise~;
#P window setfont "Fixedwidth Serif" 10.;
#P message 719 435 20 1441802 45;
#P user number~ 487 603 560 618 10 22 2 2 0. 0. 128 0. 125 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont Times 10.;
#P comment 695 603 52 1310730 Right Gain;
#P comment 560 603 45 1310730 Left Gain;
#P window setfont "Fixedwidth Serif" 10.;
#P user number~ 622 603 695 618 10 22 2 2 0. 0. 128 0. 125 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 281 603 27 1441802 *~;
#P newex 441 549 32 1441802 == 0;
#P newex 441 570 43 1441802 sig~ 1;
#P window setfont Times 10.;
#P comment 754 521 35 1310730 degrees;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 320 604 27 1441802 *~;
#P window setfont "Fixedwidth Serif" 14.;
#P flonum 300 522 53 14 0. 1. 3 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont Times 14.;
#P comment 359 521 53 1310734 Volume;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 281 572 29 1441802 *~;
#P user umenu 508 391 188 1441833 1 64 407 0;
#X add Panning Off;
#X add Simple Linear Crossfade;
#X add Equal Distance Crossfade;
#X add Speaker-to-Speaker Crossfade;
#P newex 508 453 84 1441802 gate 3;
#P newex 622 570 73 1441802 selector~ 3;
#P newex 487 570 73 1441802 selector~ 3;
#P window setfont Times 10.;
#P comment 707 507 67 1310730 Speaker Angle;
#P window setfont "Fixedwidth Serif" 10.;
#P number 719 521 35 10 15 75 3 22 0 0 0 221 221 221 222 222 222 0 0 0;
#N vpatcher 12 41 527 467;
#P window setfont Times 10.;
#P comment 163 346 278 1310730 Crossfade simulating the source moving in a straight line from speaker to speaker (which means it would be closer to the listener when it is in the center than when it is at one extreme or the other).;
#P comment 58 386 36 1310730 R Gain;
#P window setfont "Fixedwidth Serif" 10.;
#P message 65 327 38 1441802 $1 20;
#P newex 65 346 55 1441802 line~ 1.;
#N comlet (signal) right channel gain;
#P outlet 65 371 15 0;
#N comlet (signal) left channel gain;
#P outlet 7 371 15 0;
#P newex 7 346 55 1441802 line~ 1.;
#P message 7 327 38 1441802 $1 20;
#P window setfont Times 10.;
#P comment 207 21 112 1310730 Speaker Angle (in degrees);
#N comlet (int) speaker angle;
#P inlet 192 21 15 0;
#P window setfont "Fixedwidth Serif" 10.;
#P flonum 192 60 62 10 0 0 128 22 0 0 0 221 221 221 222 222 222 0 0 0;
#N comlet (int) MIDI panning;
#P inlet 65 39 15 0;
#P window setfont Times 10.;
#P comment 254 60 69 1310730 Speaker Angle;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 192 39 43 1441802 / 360.;
#P newex 192 82 140 1441802 expr 1/cos(6.2832*$f1);
#P flonum 192 103 62 10 0 0 128 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont Times 10.;
#P comment 254 103 76 1310730 Speaker Distance;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 65 57 32 1441802 – 64;
#P newex 65 78 73 1441802 split -64 0;
#P newex 65 196 128 1441802 expr sqrt($f1*$f1+1);
#P newex 65 99 38 1441802 / 64.;
#P newex 128 99 38 1441802 / 63.;
#P window setfont Times 10.;
#P comment 127 217 76 1310730 Source Distance;
#P window setfont "Fixedwidth Serif" 10.;
#P flonum 65 217 62 10 0 0 128 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 172 125 128 1441802 expr tan(6.2832*$f1);
#P flonum 172 146 61 10 0 0 128 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont Times 10.;
#P comment 233 146 85 1310730 Speaker Offset L-R;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 74 128 38 1441802 t b f;
#P newex 65 153 47 1441802 * 1.;
#P window setfont Times 10.;
#P comment 80 39 67 1310730 MIDI Panning;
#P comment 126 174 79 1310730 Source Offset L-R;
#P window setfont "Fixedwidth Serif" 10.;
#P flonum 65 174 61 10 0 0 128 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont Times 10.;
#P comment 268 217 76 1310730 Source Angle;
#P window setfont "Fixedwidth Serif" 10.;
#P flonum 206 217 62 10 0 0 128 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 206 196 134 1441802 expr atan($f1)/6.2832;
#P newex 65 239 434 1441802 expr cos(($f2+$f4)*6.2832)*$f3/$f1*2/($f3+1);
#P newex 65 285 434 1441802 expr cos(($f2-$f4)*6.2832)*$f3/$f1*2/($f3+1);
#P window setfont Times 10.;
#P comment 0 386 36 1310730 L Gain;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 65 306 173 1441802 if $f1 > 0. then $f1 else 0.;
#P newex 65 260 173 1441802 if $f1 > 0. then $f1 else 0.;
#P fasten 0 0 32 0 70 281 12 281;
#P connect 32 0 33 0;
#P connect 33 0 34 0;
#P connect 28 0 22 0;
#P connect 22 0 21 0;
#P connect 21 0 19 0;
#P connect 19 0 11 0;
#P fasten 18 0 11 0 133 120 70 120;
#P fasten 12 0 11 0 79 149 70 149;
#P connect 11 0 8 0;
#P connect 8 0 20 0;
#P connect 20 0 16 0;
#P connect 16 0 4 0;
#P connect 4 0 0 0;
#P connect 16 0 3 0;
#P connect 3 0 1 0;
#P connect 1 0 37 0;
#P connect 37 0 36 0;
#P connect 36 0 35 0;
#P fasten 14 0 12 0 177 164 116 164 116 124 79 124;
#P connect 12 1 11 1;
#P connect 21 1 18 0;
#P fasten 29 0 15 0 197 78 177 78;
#P connect 15 0 14 0;
#P connect 30 0 26 0;
#P connect 26 0 29 0;
#P connect 29 0 25 0;
#P connect 25 0 24 0;
#P fasten 8 0 5 0 70 192 211 192;
#P connect 5 0 6 0;
#P connect 6 0 4 1;
#P connect 6 0 3 1;
#P fasten 24 0 4 2 197 121 352 121;
#P fasten 24 0 3 2 197 121 352 121;
#P fasten 29 0 4 3 197 78 493 78;
#P fasten 29 0 3 3 197 78 493 78;
#P pop;
#P newobj 538 539 191 1441802 p "speaker-to-speaker xfade";
#N vpatcher 152 77 450 348;
#P window setfont Times 10.;
#P comment 177 140 103 1310730 Crossfade in which the intensity of the combined channels (and thus the impression of distance from the sound source) is kept constant , as if the sound were travelling on an arc with the listener at the center.;
#P comment 82 230 37 1310730 R Gain;
#P comment 13 230 37 1310730 L Gain;
#N comlet (signal) right channel gain;
#P outlet 91 215 15 0;
#N comlet (signal) left channel gain;
#P outlet 21 215 15 0;
#N comlet (int) MIDI panning;
#P inlet 54 38 15 0;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 21 190 43 1441802 cycle~;
#P flonum 54 102 67 10 0 0 128 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 54 56 68 1441802 split 0 64;
#P newex 54 139 74 1441802 line~ 0.125;
#P message 54 120 38 1441802 $1 20;
#P newex 54 77 43 1441802 / 512.;
#P newex 124 165 50 1441802 +~ 0.75;
#P newex 91 190 43 1441802 cycle~;
#P newex 112 77 152 1441802 expr ($i1-64)/504.+0.125;
#P window setfont Times 10.;
#P comment 69 38 67 1310730 MIDI Panning;
#P connect 9 0 11 0;
#P connect 10 0 7 0;
#P connect 7 0 4 0;
#P connect 4 0 8 0;
#P fasten 1 0 8 0 117 98 59 98;
#P connect 8 0 5 0;
#P connect 5 0 6 0;
#P connect 6 0 9 1;
#P connect 2 0 12 0;
#P connect 7 1 1 0;
#P fasten 6 0 3 0 59 160 129 160;
#P connect 3 0 2 1;
#P pop;
#P newobj 523 507 170 1441802 p "constant distance xfade";
#N vpatcher 175 50 422 290;
#P window setfont Times 10.;
#P comment 5 29 93 1310730 Simple linear crossfade with amplitude tracking the MIDI panning value.;
#P comment 89 178 35 1310730 R Gain;
#P comment 36 178 35 1310730 L Gain;
#N comlet (signal) right channel gain;
#P outlet 99 163 15 0;
#N comlet (signal) left channel gain;
#P outlet 45 163 15 0;
#N comlet (int) MIDI panning;
#P inlet 99 29 15 0;
#P comment 114 29 67 1310730 MIDI Panning;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 99 47 68 1441802 split 0 64;
#P newex 99 68 43 1441802 / 128.;
#P newex 157 68 44 1441802 / 127.;
#P newex 99 112 62 1441802 line~ 0.5;
#P message 99 93 38 1441802 $1 20;
#P newex 45 112 50 1441802 sig~ 1.;
#P newex 45 138 27 1441802 -~;
#P connect 1 0 0 0;
#P connect 0 0 9 0;
#P fasten 3 0 0 1 104 133 67 133;
#P connect 8 0 6 0;
#P connect 6 0 5 0;
#P connect 5 0 2 0;
#P fasten 4 0 2 0 162 89 104 89;
#P connect 2 0 3 0;
#P connect 3 0 10 0;
#P connect 6 1 4 0;
#P pop;
#P newobj 508 474 145 1441802 p "simple linear xfade";
#P window setfont Times 10.;
#P comment 617 435 67 1310730 MIDI Panning;
#P window setfont "Fixedwidth Serif" 10.;
#P number 582 435 35 10 0 127 3 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont Times 10.;
#P comment 540 371 111 1310730 Three panning algorithms;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 719 410 58 1441802 loadbang;
#P message 695 435 20 1441802 64;
#P window setfont "Sans Serif" 12.;
#P comment 330 104 67 196620 Envelope;
#P window setfont "Sans Serif" 9.;
#P comment 487 242 27 196617 Left;
#P connect 41 0 53 0;
#P connect 39 0 35 0;
#P connect 47 0 35 0;
#P connect 54 0 35 0;
#P connect 29 0 37 0;
#P connect 37 0 16 0;
#P connect 16 0 23 0;
#P connect 33 0 34 0;
#P connect 32 0 34 0;
#P connect 23 0 34 0;
#P fasten 21 0 23 1 446 591 303 591;
#P fasten 12 0 23 1 492 591 303 591;
#P connect 58 0 59 0;
#P connect 59 0 18 0;
#P connect 18 0 16 1;
#P connect 19 0 34 1;
#P connect 44 0 37 1;
#P connect 16 0 19 0;
#P connect 35 1 44 0;
#P fasten 13 0 19 1 627 596 342 596;
#P connect 21 0 19 1;
#P connect 61 0 38 0;
#P connect 38 0 39 0;
#P fasten 15 0 22 0 513 410 492 410 492 545 446 545;
#P connect 22 0 21 0;
#P fasten 15 0 12 0 513 410 492 410;
#P fasten 21 0 27 0 446 591 492 591;
#P connect 12 0 27 0;
#P connect 60 0 61 0;
#P connect 63 0 64 0;
#P connect 64 0 15 0;
#P connect 15 0 14 0;
#P connect 14 0 7 0;
#P connect 7 0 12 1;
#P connect 48 0 45 0;
#P connect 39 0 45 0;
#P connect 55 0 45 0;
#P fasten 14 1 8 0 550 503 528 503;
#P fasten 8 0 12 2 528 565 534 565;
#P fasten 14 2 9 0 587 535 543 535;
#P fasten 9 0 12 3 543 560 555 560;
#P connect 45 1 42 0;
#P connect 51 0 49 0;
#P connect 42 0 49 0;
#P connect 49 0 50 0;
#P connect 50 0 46 0;
#P connect 43 0 5 0;
#P fasten 2 0 5 0 700 455 687 455 687 431 587 431;
#P connect 5 0 14 1;
#P connect 57 0 52 0;
#P connect 52 0 51 0;
#P fasten 15 0 13 0 513 410 504 410 504 560 627 560;
#P connect 13 0 24 0;
#P fasten 21 0 24 0 446 596 627 596;
#P connect 7 1 13 1;
#P fasten 8 1 13 2 688 560 669 560;
#P fasten 9 1 13 3 724 565 690 565;
#P fasten 3 0 2 0 724 431 700 431;
#P connect 3 0 28 0;
#P connect 28 0 10 0;
#P connect 10 0 9 1;
#P connect 3 0 56 0;
#P pop;


January 2, 2009 | 1:06 am

Hi Blazorge,

The base of your problem lies in the fact that you mix up control rate messages and audio-streams. each control rate message takes from 1 to 20 ms to take hold (this depends on your preferences settings regarding the scheduler).

When you end the sweep you stay on 127 and keep doing snapshots. This means that when you start there has just been a snapshot of 127 ready at the right side of your signal multiplication.

As soon as you push the bang button, the noise starts. your Linear Crosfade though is still busy to go from right (your 127 devided by 127) to left (what takes an amazing 20 ms because of the line object!!!

I made a small addition that takes the panningpoint back to the start (The 2nd outlet of the breakpoint function editor sents out a float and then a list. I pick out the float which is the first Y-value of the breakpoint function). I wait till the audio-envelope is finished end then I bang the float that is waiting in the message box to the line-object that is instantly reset to the begin point.

I hope that will answer your question.

max v2;
#N vpatcher 42 59 1186 769;
#P origin 0 52;
#P window setfont "Sans Serif" 9.;
#P message 479 346 50 196617 0.;
#P newex 480 314 62 196617 prepend set;
#P newex 480 288 58 196617 route float;
#P message 568 377 14 196617 1;
#P newex 568 359 24 196617 r lb;
#P comment 544 169 31 196617 Right;
#P message 563 58 34 196617 5000;
#P newex 563 40 24 196617 r lb;
#P message 360 508 23 196617 0.1;
#P newex 360 486 24 196617 r lb;
#P newex 715 270 24 196617 r lb;
#P newex 807 444 24 196617 s lb;
#P newex 612 137 41 196617 r start;
#P newex 345 137 41 196617 r start;
#P newex 164 156 41 196617 s start;
#P toggle 676 272 15 0;
#P newex 676 293 46 196617 metro 2;
#P number 641 337 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 639 315 55 196617 snapshot~;
#P message 576 137 33 196617 clear;
#P message 305 137 33 196617 clear;
#P newex 641 357 33 196617 s pan;
#P user function 576 165 776 265 1 1 0 0;
#X frgb 0 0 0;
#X brgb 202 221 126;
#X rgb2 0 0 0;
#X rgb3 255 255 255;
#X rgb4 0 0 0;
#X rgb5 0 0 0;
#X add 0. 0. 0;
#X add 5000. 127. 0;
#X domain 5000.;
#X range 0. 127.;
#X done;
#P newex 383 276 32 196617 line~;
#P newex 642 417 33 196617 r pan;
#P newex 639 272 32 196617 line~;
#P button 164 84 66 0;
#P window setfont Times 14.;
#P comment 502 52 57 1310734 Duration;
#P window setfont "Fixedwidth Serif" 10.;
#P message 501 100 80 1441802 setdomain $1;
#P flonum 501 74 60 10 0. 0 1 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont "Sans Serif" 9.;
#P newex 341 344 41 196617 *~ 0.2;
#P window setfont "Sans Serif" 12.;
#P comment 649 114 62 196620 Panning;
#P user function 320 166 520 266 1 1 0 0;
#X frgb 0 0 0;
#X brgb 202 221 126;
#X rgb2 0 0 0;
#X rgb3 255 255 255;
#X rgb4 0 0 0;
#X rgb5 0 0 0;
#X add 0. 0. 0;
#X add 53.191509 1. 0;
#X add 4973.410156 1. 0;
#X add 5000. 0. 0;
#X domain 5000.;
#X range 0. 1.;
#X done;
#P window setfont "Sans Serif" 9.;
#P newex 341 678 31 196617 dac~;
#P message 566 661 27 196617 stop;
#P message 496 660 65 196617 startwindow;
#P comment 499 646 75 196617 • start audio;
#P user panel 484 640 123 43;
#X brgb 255 255 255;
#X frgb 100 202 30;
#X border 2;
#X rounded 0;
#X shadow 0;
#X done;
#P newex 341 319 39 196617 noise~;
#P window setfont "Fixedwidth Serif" 10.;
#P message 779 443 20 1441802 45;
#P user number~ 547 611 620 626 10 22 2 2 0. 0. 128 0. 125 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont Times 10.;
#P comment 755 611 52 1310730 Right Gain;
#P comment 620 611 45 1310730 Left Gain;
#P window setfont "Fixedwidth Serif" 10.;
#P user number~ 682 611 755 626 10 22 2 2 0. 0. 128 0. 125 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 341 611 27 1441802 *~;
#P newex 501 557 32 1441802 == 0;
#P newex 501 578 43 1441802 sig~ 1;
#P window setfont Times 10.;
#P comment 814 529 35 1310730 degrees;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 380 612 27 1441802 *~;
#P window setfont "Fixedwidth Serif" 14.;
#P flonum 360 530 53 14 0. 1. 3 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont Times 14.;
#P comment 419 529 53 1310734 Volume;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 341 580 29 1441802 *~;
#P user umenu 568 399 188 1441833 1 64 415 0;
#X add Panning Off;
#X add Simple Linear Crossfade;
#X add Equal Distance Crossfade;
#X add Speaker-to-Speaker Crossfade;
#P newex 568 461 84 1441802 gate 3;
#P newex 682 578 73 1441802 selector~ 3;
#P newex 547 578 73 1441802 selector~ 3;
#P window setfont Times 10.;
#P comment 767 515 67 1310730 Speaker Angle;
#P window setfont "Fixedwidth Serif" 10.;
#P number 779 529 35 10 15 75 3 22 0 0 0 221 221 221 222 222 222 0 0 0;
#N vpatcher 12 41 527 467;
#P window setfont Times 10.;
#P comment 163 346 278 1310730 Crossfade simulating the source moving in a straight line from speaker to speaker (which means it would be closer to the listener when it is in the center than when it is at one extreme or the other).;
#P comment 58 386 36 1310730 R Gain;
#P window setfont "Fixedwidth Serif" 10.;
#P message 65 327 38 1441802 $1 20;
#P newex 65 346 55 1441802 line~ 1.;
#N comlet (signal) right channel gain;
#P outlet 65 371 15 0;
#N comlet (signal) left channel gain;
#P outlet 7 371 15 0;
#P newex 7 346 55 1441802 line~ 1.;
#P message 7 327 38 1441802 $1 20;
#P window setfont Times 10.;
#P comment 207 21 112 1310730 Speaker Angle (in degrees);
#N comlet (int) speaker angle;
#P inlet 192 21 15 0;
#P window setfont "Fixedwidth Serif" 10.;
#P flonum 192 60 62 10 0 0 128 22 0 0 0 221 221 221 222 222 222 0 0 0;
#N comlet (int) MIDI panning;
#P inlet 65 39 15 0;
#P window setfont Times 10.;
#P comment 254 60 69 1310730 Speaker Angle;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 192 39 43 1441802 / 360.;
#P newex 192 82 140 1441802 expr 1/cos(6.2832*$f1);
#P flonum 192 103 62 10 0 0 128 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont Times 10.;
#P comment 254 103 76 1310730 Speaker Distance;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 65 57 32 1441802 – 64;
#P newex 65 78 73 1441802 split -64 0;
#P newex 65 196 128 1441802 expr sqrt($f1*$f1+1);
#P newex 65 99 38 1441802 / 64.;
#P newex 128 99 38 1441802 / 63.;
#P window setfont Times 10.;
#P comment 127 217 76 1310730 Source Distance;
#P window setfont "Fixedwidth Serif" 10.;
#P flonum 65 217 62 10 0 0 128 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 172 125 128 1441802 expr tan(6.2832*$f1);
#P flonum 172 146 61 10 0 0 128 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont Times 10.;
#P comment 233 146 85 1310730 Speaker Offset L-R;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 74 128 38 1441802 t b f;
#P newex 65 153 47 1441802 * 1.;
#P window setfont Times 10.;
#P comment 80 39 67 1310730 MIDI Panning;
#P comment 126 174 79 1310730 Source Offset L-R;
#P window setfont "Fixedwidth Serif" 10.;
#P flonum 65 174 61 10 0 0 128 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont Times 10.;
#P comment 268 217 76 1310730 Source Angle;
#P window setfont "Fixedwidth Serif" 10.;
#P flonum 206 217 62 10 0 0 128 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 206 196 134 1441802 expr atan($f1)/6.2832;
#P newex 65 239 434 1441802 expr cos(($f2+$f4)*6.2832)*$f3/$f1*2/($f3+1);
#P newex 65 285 434 1441802 expr cos(($f2-$f4)*6.2832)*$f3/$f1*2/($f3+1);
#P window setfont Times 10.;
#P comment 0 386 36 1310730 L Gain;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 65 306 173 1441802 if $f1 > 0. then $f1 else 0.;
#P newex 65 260 173 1441802 if $f1 > 0. then $f1 else 0.;
#P fasten 0 0 32 0 70 281 12 281;
#P connect 32 0 33 0;
#P connect 33 0 34 0;
#P connect 28 0 22 0;
#P connect 22 0 21 0;
#P connect 21 0 19 0;
#P fasten 12 0 11 0 79 149 70 149;
#P fasten 18 0 11 0 133 120 70 120;
#P connect 19 0 11 0;
#P connect 11 0 8 0;
#P connect 8 0 20 0;
#P connect 20 0 16 0;
#P connect 16 0 4 0;
#P connect 4 0 0 0;
#P connect 16 0 3 0;
#P connect 3 0 1 0;
#P connect 1 0 37 0;
#P connect 37 0 36 0;
#P connect 36 0 35 0;
#P fasten 14 0 12 0 177 164 116 164 116 124 79 124;
#P connect 12 1 11 1;
#P connect 21 1 18 0;
#P fasten 29 0 15 0 197 78 177 78;
#P connect 15 0 14 0;
#P connect 30 0 26 0;
#P connect 26 0 29 0;
#P connect 29 0 25 0;
#P connect 25 0 24 0;
#P fasten 8 0 5 0 70 192 211 192;
#P connect 5 0 6 0;
#P connect 6 0 4 1;
#P connect 6 0 3 1;
#P fasten 24 0 4 2 197 121 352 121;
#P fasten 24 0 3 2 197 121 352 121;
#P fasten 29 0 4 3 197 78 493 78;
#P fasten 29 0 3 3 197 78 493 78;
#P pop;
#P newobj 598 547 191 1441802 p "speaker-to-speaker xfade";
#N vpatcher 152 77 450 348;
#P window setfont Times 10.;
#P comment 177 140 103 1310730 Crossfade in which the intensity of the combined channels (and thus the impression of distance from the sound source) is kept constant , as if the sound were travelling on an arc with the listener at the center.;
#P comment 82 230 37 1310730 R Gain;
#P comment 13 230 37 1310730 L Gain;
#N comlet (signal) right channel gain;
#P outlet 91 215 15 0;
#N comlet (signal) left channel gain;
#P outlet 21 215 15 0;
#N comlet (int) MIDI panning;
#P inlet 54 38 15 0;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 21 190 43 1441802 cycle~;
#P flonum 54 102 67 10 0 0 128 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 54 56 68 1441802 split 0 64;
#P newex 54 139 74 1441802 line~ 0.125;
#P message 54 120 38 1441802 $1 20;
#P newex 54 77 43 1441802 / 512.;
#P newex 124 165 50 1441802 +~ 0.75;
#P newex 91 190 43 1441802 cycle~;
#P newex 112 77 152 1441802 expr ($i1-64)/504.+0.125;
#P window setfont Times 10.;
#P comment 69 38 67 1310730 MIDI Panning;
#P connect 9 0 11 0;
#P connect 10 0 7 0;
#P connect 7 0 4 0;
#P fasten 1 0 8 0 117 98 59 98;
#P connect 4 0 8 0;
#P connect 8 0 5 0;
#P connect 5 0 6 0;
#P connect 6 0 9 1;
#P connect 2 0 12 0;
#P connect 7 1 1 0;
#P fasten 6 0 3 0 59 160 129 160;
#P connect 3 0 2 1;
#P pop;
#P newobj 583 515 170 1441802 p "constant distance xfade";
#N vpatcher 175 50 422 290;
#P window setfont Times 10.;
#P comment 5 29 93 1310730 Simple linear crossfade with amplitude tracking the MIDI panning value.;
#P comment 89 178 35 1310730 R Gain;
#P comment 36 178 35 1310730 L Gain;
#N comlet (signal) right channel gain;
#P outlet 99 163 15 0;
#N comlet (signal) left channel gain;
#P outlet 45 163 15 0;
#N comlet (int) MIDI panning;
#P inlet 99 29 15 0;
#P comment 114 29 67 1310730 MIDI Panning;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 99 47 68 1441802 split 0 64;
#P newex 99 68 43 1441802 / 128.;
#P newex 157 68 44 1441802 / 127.;
#P newex 99 112 62 1441802 line~ 0.5;
#P message 99 93 38 1441802 $1 20;
#P newex 45 112 50 1441802 sig~ 1.;
#P newex 45 138 27 1441802 -~;
#P connect 1 0 0 0;
#P connect 0 0 9 0;
#P fasten 3 0 0 1 104 133 67 133;
#P connect 8 0 6 0;
#P connect 6 0 5 0;
#P fasten 4 0 2 0 162 89 104 89;
#P connect 5 0 2 0;
#P connect 2 0 3 0;
#P connect 3 0 10 0;
#P connect 6 1 4 0;
#P pop;
#P newobj 568 482 145 1441802 p "simple linear xfade";
#P window setfont Times 10.;
#P comment 677 443 67 1310730 MIDI Panning;
#P window setfont "Fixedwidth Serif" 10.;
#P number 642 443 35 10 0 127 3 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont Times 10.;
#P comment 600 379 111 1310730 Three panning algorithms;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 779 418 58 1441802 loadbang;
#P message 755 443 20 1441802 64;
#P window setfont "Sans Serif" 12.;
#P comment 390 112 67 196620 Envelope;
#P window setfont "Sans Serif" 9.;
#P comment 547 250 27 196617 Left;
#P connect 41 0 53 0;
#P connect 39 0 35 0;
#P connect 54 0 35 0;
#P connect 47 0 35 0;
#P connect 29 0 37 0;
#P connect 37 0 16 0;
#P connect 16 0 23 0;
#P connect 23 0 34 0;
#P connect 32 0 34 0;
#P connect 33 0 34 0;
#P fasten 21 0 23 1 506 599 363 599;
#P fasten 12 0 23 1 552 599 363 599;
#P connect 58 0 59 0;
#P connect 59 0 18 0;
#P connect 18 0 16 1;
#P connect 19 0 34 1;
#P connect 44 0 37 1;
#P connect 16 0 19 0;
#P connect 35 1 44 0;
#P connect 21 0 19 1;
#P fasten 13 0 19 1 687 604 402 604;
#P connect 44 1 67 0;
#P connect 66 0 67 0;
#P connect 45 1 65 0;
#P connect 65 0 66 0;
#P connect 61 0 38 0;
#P connect 38 0 39 0;
#P fasten 15 0 22 0 573 418 552 418 552 553 506 553;
#P connect 22 0 21 0;
#P fasten 15 0 12 0 573 418 552 418;
#P fasten 21 0 27 0 506 599 552 599;
#P connect 12 0 27 0;
#P connect 60 0 61 0;
#P connect 63 0 64 0;
#P connect 64 0 15 0;
#P connect 15 0 14 0;
#P connect 14 0 7 0;
#P connect 7 0 12 1;
#P connect 55 0 45 0;
#P connect 39 0 45 0;
#P connect 48 0 45 0;
#P fasten 14 1 8 0 610 511 588 511;
#P fasten 8 0 12 2 588 573 594 573;
#P fasten 14 2 9 0 647 543 603 543;
#P fasten 9 0 12 3 603 568 615 568;
#P connect 67 0 42 0;
#P connect 45 1 42 0;
#P connect 42 0 49 0;
#P connect 51 0 49 0;
#P connect 49 0 50 0;
#P connect 50 0 46 0;
#P fasten 2 0 5 0 760 463 747 463 747 439 647 439;
#P connect 43 0 5 0;
#P connect 5 0 14 1;
#P connect 57 0 52 0;
#P connect 52 0 51 0;
#P fasten 15 0 13 0 573 418 564 418 564 568 687 568;
#P fasten 21 0 24 0 506 604 687 604;
#P connect 13 0 24 0;
#P connect 7 1 13 1;
#P fasten 8 1 13 2 748 568 729 568;
#P fasten 9 1 13 3 784 573 750 573;
#P fasten 3 0 2 0 784 439 760 439;
#P connect 3 0 28 0;
#P connect 28 0 10 0;
#P connect 10 0 9 1;
#P connect 3 0 56 0;
#P pop;


January 3, 2009 | 12:36 am

Thanks so much for your help. This has helped me learn a lot. Your solution is very clever and I really appreciate it. I myself added send and receive objects leading from the right outlet of the "Panning" breakpoint function editor back to it’s own inlet at the top so that when the graph is changed with a mouse action, the start position is refreshed for a new event. I don’t know anything about finessing Max/MSP/Jitter preferences (or for that matter any computer system settings) to optimize performance. I’ve always just left the default settings. I wonder if there are any articles out there that address this? Anyway, thanks very much again and Happy New Year!

-B


Viewing 5 posts - 1 through 5 (of 5 total)