Forums > MaxMSP

need help by Matrix optimization

April 24, 2006 | 9:45 am

Hello everybody,

For one of my graduation projects I’m building a step sequencer which controls my installation. The thing works but the code is way too much lines. I would like to build it more generic.

I use a matrix for the gui and the getcolumn output linked on to my audiotracks. Works great.

Now I want to control a led board. So I use 2 routes so set a led on and off and de decode to show the time steps. And this part is a bit of a mess. please take a look my code.

Probably a newbee question again but at least it’s not a DJ patch.

The max patch 4.5:

max v2;
#N vpatcher 21 44 1278 857;
#P origin -50 -102;
#P window setfont "Sans Serif" 9.;
#P comment 557 157 181 196617 ONLY BUILD THE 1st TRACK;
#P window linecount 3;
#P comment 455 474 181 196617 I need this 8 times , I bet there is a shorter nice way , but I can figure this out…;
#P window linecount 1;
#P newex 1172 607 43 196617 route 0;
#P newex 1135 651 27 196617 !- 1;
#P newex 1172 674 27 196617 1;
#P toggle 1172 630 15 0;
#P newex 1172 651 32 196617 sel 1;
#P newex 1135 674 29 196617 gate;
#P user pictctrl 1135 710 16 16 greenLED.pict 0 0 1 1 3 0 0 0 32 34 128 0 1 1 2 0 1 270;
#P newex 1100 608 43 196617 route 0;
#P newex 1063 652 27 196617 !- 1;
#P newex 1100 675 27 196617 1;
#P toggle 1100 631 15 0;
#P newex 1100 652 32 196617 sel 1;
#P newex 1063 675 29 196617 gate;
#P user pictctrl 1063 711 16 16 greenLED.pict 0 0 1 1 3 0 0 0 32 34 128 0 1 1 2 0 1 270;
#P newex 1025 608 43 196617 route 0;
#P newex 988 652 27 196617 !- 1;
#P newex 1025 675 27 196617 1;
#P toggle 1025 631 15 0;
#P newex 1025 652 32 196617 sel 1;
#P newex 988 675 29 196617 gate;
#P user pictctrl 988 711 16 16 greenLED.pict 0 16 1 1 3 0 1 0 32 34 128 0 1 1 2 0 1 270;
#P newex 946 607 43 196617 route 0;
#P newex 909 651 27 196617 !- 1;
#P newex 946 674 27 196617 1;
#P toggle 946 630 15 0;
#P newex 946 651 32 196617 sel 1;
#P newex 909 674 29 196617 gate;
#P user pictctrl 909 710 16 16 greenLED.pict 0 0 1 1 3 0 0 0 32 34 128 0 1 1 2 0 1 270;
#P newex 871 607 43 196617 route 0;
#P newex 834 651 27 196617 !- 1;
#P newex 871 674 27 196617 1;
#P toggle 871 630 15 0;
#P newex 871 651 32 196617 sel 1;
#P newex 834 674 29 196617 gate;
#P user pictctrl 834 710 16 16 greenLED.pict 0 0 1 1 3 0 0 0 32 34 128 0 1 1 2 0 1 270;
#P newex 799 608 43 196617 route 0;
#P newex 762 652 27 196617 !- 1;
#P newex 799 675 27 196617 1;
#P toggle 799 631 15 0;
#P newex 799 652 32 196617 sel 1;
#P newex 762 675 29 196617 gate;
#P user pictctrl 762 711 16 16 greenLED.pict 0 0 1 1 3 0 0 0 32 34 128 0 1 1 2 0 1 270;
#P newex 724 608 43 196617 route 0;
#P newex 687 652 27 196617 !- 1;
#P newex 724 675 27 196617 1;
#P toggle 724 631 15 0;
#P newex 724 652 32 196617 sel 1;
#P newex 687 675 29 196617 gate;
#P user pictctrl 687 711 16 16 greenLED.pict 0 0 1 1 3 0 0 0 32 34 128 0 1 1 2 0 1 270;
#P newex 645 607 43 196617 route 0;
#P newex 608 651 27 196617 !- 1;
#P newex 645 674 27 196617 1;
#P toggle 645 630 15 0;
#P newex 645 651 32 196617 sel 1;
#P newex 608 674 29 196617 gate;
#P user pictctrl 608 710 16 16 greenLED.pict 0 0 1 1 3 0 0 0 32 34 128 0 1 1 2 0 1 270;
#P comment 498 734 32 196617 LED’s;
#P newex 564 606 43 196617 route 0;
#P newex 527 650 27 196617 !- 1;
#P newex 564 673 27 196617 1;
#P toggle 564 629 15 0;
#P newex 564 650 32 196617 sel 1;
#P newex 527 673 29 196617 gate;
#P user pictctrl 527 709 16 16 greenLED.pict 0 0 1 1 3 0 0 0 32 34 128 0 1 1 2 0 1 270;
#P newex 492 607 43 196617 route 0;
#P newex 455 651 27 196617 !- 1;
#P newex 492 674 27 196617 1;
#P toggle 492 630 15 0;
#P newex 492 651 32 196617 sel 1;
#P newex 455 674 29 196617 gate;
#P user pictctrl 455 710 16 16 greenLED.pict 0 0 1 1 3 0 0 0 32 34 128 0 1 1 2 0 1 270;
#P newex 417 607 43 196617 route 0;
#P newex 380 651 27 196617 !- 1;
#P newex 417 674 27 196617 1;
#P toggle 417 630 15 0;
#P newex 417 651 32 196617 sel 1;
#P newex 380 674 29 196617 gate;
#P user pictctrl 380 710 16 16 greenLED.pict 0 0 1 1 3 0 0 0 32 34 128 0 1 1 2 0 1 270;
#P newex 338 606 43 196617 route 0;
#P newex 301 650 27 196617 !- 1;
#P newex 338 673 27 196617 1;
#P toggle 338 629 15 0;
#P newex 338 650 32 196617 sel 1;
#P newex 301 673 29 196617 gate;
#P user pictctrl 301 709 16 16 greenLED.pict 0 0 1 1 3 0 0 0 32 34 128 0 1 1 2 0 1 270;
#P newex 263 606 43 196617 route 0;
#P newex 226 650 27 196617 !- 1;
#P newex 263 673 27 196617 1;
#P toggle 263 629 15 0;
#P newex 263 650 32 196617 sel 1;
#P newex 226 673 29 196617 gate;
#P user pictctrl 226 709 16 16 greenLED.pict 0 0 1 1 3 0 0 0 32 34 128 0 1 1 2 0 1 270;
#P newex 191 607 43 196617 route 0;
#P newex 154 651 27 196617 !- 1;
#P newex 191 674 27 196617 1;
#P toggle 191 630 15 0;
#P newex 191 651 32 196617 sel 1;
#P newex 154 674 29 196617 gate;
#P user pictctrl 154 710 16 16 greenLED.pict 0 0 1 1 3 0 0 0 32 34 128 0 1 1 2 0 1 270;
#P newex 116 607 43 196617 route 0;
#P newex 79 651 27 196617 !- 1;
#P newex 116 674 27 196617 1;
#P toggle 116 630 15 0;
#P newex 116 651 32 196617 sel 1;
#P newex 79 674 29 196617 gate;
#P user pictctrl 79 710 16 16 greenLED.pict 0 0 1 1 3 0 0 0 32 34 128 0 1 1 2 0 1 270;
#P newex 37 606 43 196617 route 0;
#P newex 0 650 27 196617 !- 1;
#P newex 37 673 27 196617 1;
#P toggle 37 629 15 0;
#P newex 37 650 32 196617 sel 1;
#P newex 0 673 29 196617 gate;
#P user pictctrl 0 709 16 16 greenLED.pict 0 0 1 1 3 0 0 0 32 34 128 0 1 1 2 0 1 270;
#P newex 37 548 1237 196617 route 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15;
#P newex 19 522 1159 196617 decode 16;
#P message 128 137 70 196617 getcolumn $1;
#P number 153 77 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 126 61 26 196617 I/O;
#P comment 151 61 38 196617 BPM;
#P number 129 117 32 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 129 97 82 196617 tempo 100 1 16;
#B color 5;
#P toggle 129 77 15 0;
#P message 206 137 33 196617 clear;
#P newex 128 364 197 196617 unpack 0 0 0 0 0 0 0 0;
#P user pictctrl 154 393 16 16 greenLED.pict 0 0 1 1 3 0 0 0 32 34 128 0 1 1 2 0 1 270;
#P user pictctrl 206 393 16 16 greenLED.pict 0 0 1 1 3 0 0 0 32 34 128 0 1 1 2 0 1 270;
#P user pictctrl 232 393 16 16 greenLED.pict 0 0 1 1 3 0 0 0 32 34 128 0 1 1 2 0 1 270;
#P user pictctrl 258 393 16 16 greenLED.pict 0 0 1 1 3 0 0 0 32 34 128 0 1 1 2 0 1 270;
#P user pictctrl 284 393 16 16 greenLED.pict 0 0 1 1 3 0 0 0 32 34 128 0 1 1 2 0 1 270;
#P user pictctrl 310 393 16 16 greenLED.pict 0 0 1 1 3 0 0 0 32 34 128 0 1 1 2 0 1 270;
#P user pictctrl 180 393 16 16 greenLED.pict 0 0 1 1 3 0 0 0 32 34 128 0 1 1 2 0 1 270;
#P user pictctrl 128 393 16 16 greenLED.pict 0 0 1 1 3 0 0 0 32 34 128 0 1 1 2 0 1 270;
#P user matrixctrl 126 156 413 203 MatrixDefaultCell.pct MatrixDefaultBkgnd.pct 413 203 16 16 16 8 26 26 0 0 304 2 5120 0;
#P objectname seq;
#P comment 334 396 181 196617 I NEED THIS TO PLAY AUDIO;
#P connect 24 0 26 0;
#P connect 26 0 22 0;
#P connect 22 0 21 0;
#P connect 25 0 21 0;
#P connect 14 0 19 0;
#P connect 19 0 22 1;
#P connect 1 0 20 0;
#P connect 20 0 27 0;
#P connect 27 0 24 0;
#P connect 24 0 23 0;
#P connect 23 0 25 0;
#P connect 31 0 33 0;
#P connect 33 0 29 0;
#P connect 32 0 28 0;
#P connect 29 0 28 0;
#P connect 19 1 29 1;
#P connect 20 1 34 0;
#P connect 34 0 31 0;
#P connect 31 0 30 0;
#P connect 30 0 32 0;
#P connect 11 0 1 0;
#P connect 18 0 1 0;
#P connect 14 0 18 0;
#P connect 1 1 10 0;
#P connect 10 0 2 0;
#P connect 12 0 13 0;
#P connect 13 0 14 0;
#P connect 17 0 13 1;
#P connect 10 1 9 0;
#P connect 38 0 40 0;
#P connect 40 0 36 0;
#P connect 36 0 35 0;
#P connect 39 0 35 0;
#P connect 19 2 36 1;
#P connect 10 2 3 0;
#P connect 20 2 41 0;
#P connect 41 0 38 0;
#P connect 38 0 37 0;
#P connect 37 0 39 0;
#P connect 10 3 8 0;
#P connect 45 0 47 0;
#P connect 47 0 43 0;
#P connect 46 0 42 0;
#P connect 43 0 42 0;
#P connect 10 4 7 0;
#P connect 19 3 43 1;
#P connect 10 5 6 0;
#P connect 20 3 48 0;
#P connect 48 0 45 0;
#P connect 45 0 44 0;
#P connect 44 0 46 0;
#P connect 10 6 5 0;
#P connect 52 0 54 0;
#P connect 54 0 50 0;
#P connect 53 0 49 0;
#P connect 50 0 49 0;
#P connect 10 7 4 0;
#P connect 19 4 50 1;
#P connect 20 4 55 0;
#P connect 55 0 52 0;
#P connect 52 0 51 0;
#P connect 51 0 53 0;
#P connect 59 0 61 0;
#P connect 61 0 57 0;
#P connect 57 0 56 0;
#P connect 60 0 56 0;
#P connect 19 5 57 1;
#P connect 20 5 62 0;
#P connect 62 0 59 0;
#P connect 59 0 58 0;
#P connect 58 0 60 0;
#P connect 66 0 68 0;
#P connect 68 0 64 0;
#P connect 67 0 63 0;
#P connect 64 0 63 0;
#P connect 19 6 64 1;
#P connect 20 6 69 0;
#P connect 69 0 66 0;
#P connect 66 0 65 0;
#P connect 65 0 67 0;
#P connect 73 0 75 0;
#P connect 75 0 71 0;
#P connect 71 0 70 0;
#P connect 74 0 70 0;
#P connect 19 7 71 1;
#P connect 20 7 76 0;
#P connect 76 0 73 0;
#P connect 73 0 72 0;
#P connect 72 0 74 0;
#P connect 81 0 83 0;
#P connect 83 0 79 0;
#P connect 82 0 78 0;
#P connect 79 0 78 0;
#P connect 19 8 79 1;
#P connect 20 8 84 0;
#P connect 84 0 81 0;
#P connect 81 0 80 0;
#P connect 80 0 82 0;
#P connect 88 0 90 0;
#P connect 90 0 86 0;
#P connect 86 0 85 0;
#P connect 89 0 85 0;
#P connect 19 9 86 1;
#P connect 20 9 91 0;
#P connect 91 0 88 0;
#P connect 88 0 87 0;
#P connect 87 0 89 0;
#P connect 95 0 97 0;
#P connect 97 0 93 0;
#P connect 96 0 92 0;
#P connect 93 0 92 0;
#P connect 19 10 93 1;
#P connect 20 10 98 0;
#P connect 98 0 95 0;
#P connect 95 0 94 0;
#P connect 94 0 96 0;
#P connect 102 0 104 0;
#P connect 104 0 100 0;
#P connect 100 0 99 0;
#P connect 103 0 99 0;
#P connect 19 11 100 1;
#P connect 20 11 105 0;
#P connect 105 0 102 0;
#P connect 102 0 101 0;
#P connect 101 0 103 0;
#P connect 109 0 111 0;
#P connect 111 0 107 0;
#P connect 107 0 106 0;
#P connect 110 0 106 0;
#P connect 19 12 107 1;
#P connect 20 12 112 0;
#P connect 112 0 109 0;
#P connect 109 0 108 0;
#P connect 108 0 110 0;
#P connect 116 0 118 0;
#P connect 118 0 114 0;
#P connect 117 0 113 0;
#P connect 114 0 113 0;
#P connect 19 13 114 1;
#P connect 20 13 119 0;
#P connect 119 0 116 0;
#P connect 116 0 115 0;
#P connect 115 0 117 0;
#P connect 123 0 125 0;
#P connect 125 0 121 0;
#P connect 121 0 120 0;
#P connect 124 0 120 0;
#P connect 19 14 121 1;
#P connect 20 14 126 0;
#P connect 126 0 123 0;
#P connect 123 0 122 0;
#P connect 122 0 124 0;
#P connect 130 0 132 0;
#P connect 132 0 128 0;
#P connect 131 0 127 0;
#P connect 128 0 127 0;
#P connect 19 15 128 1;
#P connect 20 15 133 0;
#P connect 133 0 130 0;
#P connect 130 0 129 0;
#P connect 129 0 131 0;
#P pop;


Viewing 1 post (of 1 total)