noob delurking w/ abstraction

Apr 24, 2007 at 12:44am

noob delurking w/ abstraction

hi everyone. i have no question, just an abstraction. been lurking this board while i teach myself max for the past year or so and it is my humble opinion that n00bs should step with abstractions before asking dumb questions.

i’m sure there are more elegant ways to do this, but it works for me…

-JC

max v2;
#N vpatcher 225 204 592 590;
#P origin -49 0;
#P window setfont “Sans Serif” 9.;
#N vpatcher 10 59 349 425;
#P window setfont “Sans Serif” 9.;
#P newex 171 51 97 196617 r randrum_mlength;
#B color 2;
#P newex 187 149 122 196617 if $i1 < 1 then 1 else $i2;
#P message 151 150 33 196617 clear;
#P newex 69 80 99 196617 t dump b clear b set;
#P newex 168 99 34 196617 * 0.5;
#P newex 135 174 62 196617 urn;
#P newex 135 122 43 196617 uzi 8;
#P newex 91 252 40 196617 zl sort;
#P window linecount 2;
#P message 91 219 89 196617 12 0 19 23 1 9 18 11 15 8 21 5;
#P window linecount 1;
#P message 135 198 60 196617 append $1;
#P newex 91 273 52 196617 listfunnel;
#N funbuff 0;
#P newobj 69 296 42 196617 funbuff;
#P inlet 48 60 15 0;
#P inlet 69 60 15 0;
#P outlet 135 318 15 0;
#P outlet 69 318 15 0;
#P connect 2 0 12 0;
#P connect 12 0 4 0;
#P connect 12 2 4 0;
#P connect 5 0 4 0;
#P connect 3 0 4 0;
#P connect 4 0 0 0;
#P connect 6 0 7 0;
#P connect 12 1 7 0;
#P connect 12 4 7 0;
#P connect 7 0 8 0;
#P connect 8 0 5 0;
#P connect 12 3 9 0;
#P connect 13 0 10 0;
#P connect 9 0 10 0;
#P connect 10 0 6 0;
#P connect 8 0 1 0;
#P connect 9 1 13 0;
#P connect 15 0 11 0;
#P connect 11 0 9 1;
#P connect 15 0 14 0;
#P connect 14 0 10 1;
#P connect 15 0 14 1;
#P pop;
#P newobj 31 241 64 196617 p rand_fun;
#P newex 73 35 97 196617 r randrum_mlength;
#B color 2;
#P newex 112 91 97 196617 s randrum_mlength;
#B color 2;
#P newex 114 51 60 196617 loadmess 8;
#P window linecount 2;
#P comment 100 308 46 196617 beat list out;
#N comlet list: beat list out;
#P outlet 85 308 15 0;
#N comlet count out;
#P outlet 147 308 15 0;
#P window linecount 1;
#P newex 237 80 55 196617 sel 1 bang;
#P newex 179 68 21 196617 – 1;
#P number 31 120 26 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 22 309 46 196617 beats out;
#N comlet beats out;
#P outlet 7 309 15 0;
#N comlet bang: reset beats or generate random beat list;
#P inlet 262 50 15 0;
#P window linecount 2;
#P comment 276 50 68 196617 reset random beats;
#P comment 34 52 30 196617 ticks in;
#N comlet ticks in;
#P inlet 21 52 15 0;
#N comlet measure length;
#P inlet 179 51 15 0;
#P window linecount 1;
#P newex 31 170 27 196617 t b 1;
#P message 67 120 14 196617 0;
#P number 31 221 26 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 31 147 27 196617 sel;
#P newex 31 197 45 196617 accum;
#N counter 8;
#X flags 0 0;
#P newobj 31 95 66 196617 counter 8;
#P number 31 269 26 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 113 72 24 9 0 0 1 3 198 0 0 173 173 173 222 222 222 0 0 0;
#P window linecount 2;
#P comment 195 48 46 196617 measure length;
#P window linecount 1;
#P comment 161 309 46 196617 count out;
#P connect 6 0 15 0;
#P fasten 11 0 4 0 26 85 36 85;
#P connect 4 0 17 0;
#P connect 4 0 6 0;
#P connect 6 0 9 0;
#P connect 8 0 5 0;
#P connect 9 0 5 0;
#P connect 5 0 7 0;
#P connect 7 0 26 0;
#P connect 26 0 3 0;
#P fasten 3 0 6 1 36 294 78 294 78 142 53 142;
#P connect 9 1 5 1;
#P connect 4 2 8 0;
#P connect 25 0 4 3;
#P connect 19 1 26 1;
#P connect 26 1 21 0;
#P connect 25 0 4 4;
#P connect 2 0 24 0;
#P connect 18 0 2 0;
#P connect 23 0 2 0;
#P fasten 19 0 2 0 242 99 233 99 233 69 118 69;
#P connect 4 0 20 0;
#P connect 10 0 18 0;
#P fasten 14 0 19 0 267 77 242 77;
#P pop;

#31554
Apr 24, 2007 at 1:19pm

John Cobbett schrieb:
> i’m sure there are more elegant ways to do this, but it works for me…

I am not so sure, as I don’t know exactly what it should do. It doesn’t
look too complicated and if it works for you just stick with it…
You could supply a help file for it, and it might be useful for other
list members. Sharing is fun… And congratulations…

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com

#102721
Apr 24, 2007 at 11:50pm

never made a real help.pat before, this example should work.

this is related to the “pop songwriting patch” thread. I’m (slowly) working on that idea. This is an abstraction to generate random drum patterns. using similar methods to improvise, generate basslines, drum rolls etc. the real prize will be when i have enough knowledge to hook it all up to a dictionary and voiceover utility and randomly generate and sing “pop” lyrics :)

max v2;
#N vpatcher 274 92 855 649;
#P window setfont “Sans Serif” 10.;
#P window linecount 1;
#P message 180 127 22 196618 32;
#P message 157 127 22 196618 16;
#P message 140 127 15 196618 8;
#N vpatcher 20 74 620 474;
#P window setfont “Sans Serif” 10.;
#P window linecount 1;
#P newex 50 50 48 196618 pipe 10;
#P newex 50 72 54 196618 t b clear;
#P inlet 50 30 15 0;
#P outlet 94 96 15 0;
#P outlet 50 96 15 0;
#P connect 2 0 4 0;
#P connect 4 0 3 0;
#P connect 3 0 0 0;
#P connect 3 1 1 0;
#P pop;
#P newobj 276 263 51 196618 p setmat;
#P number 253 371 35 10 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 4;
#P comment 192 333 56 196618 count comes out right outlet ->;
#P window linecount 3;
#P comment 128 233 56 196618 list comes out middle outlet ->;
#P window linecount 1;
#P message 85 431 44 196618 $1 0 1;
#P user matrixctrl 37 469 517 18 MatrixDefaultCell.pct MatrixDefaultBkgnd.pct 517 18 16 16 32 1 16 16 1 1 49 2 5120 0;
#P window linecount 5;
#P message 184 258 55 196618 3 4 9 10 12 13 14 15 17 18 19 20 25 26 29;
#P window linecount 1;
#P message 37 432 44 196618 $1 0 1;
#P newex 37 409 29 196618 iter;
#P newex 76 348 32 196618 dac~;
#P toggle 76 314 15 0;
#P message 94 314 70 196618 startwindow;
#P newex 94 273 41 196618 click~;
#P comment 288 57 100 196618 send it a pulse..;
#P button 201 149 15 0;
#P window linecount 5;
#P comment 215 129 100 196618 send it a ‘bang’ to generate pattern. bang it again to generate a new pattern;
#P button 94 250 15 0;
#P user matrixctrl 37 489 517 18 MatrixDefaultCell.pct MatrixDefaultBkgnd.pct 517 18 16 16 32 1 16 16 1 1 48 2 5120 0;
#P toggle 218 38 15 0;
#P window linecount 1;
#P newex 218 64 63 196618 metro 150;
#N vpatcher 382 381 982 781;
#P outlet 184 291 15 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#N vpatcher 10 59 349 425;
#P window setfont “Sans Serif” 9.;
#P window linecount 0;
#P newex 171 51 97 196617 r randrum_mlength;
#B color 2;
#P newex 187 149 122 196617 if $i1 < 1 then 1 else $i2;
#P message 151 150 33 196617 clear;
#P newex 69 80 99 196617 t dump b clear b set;
#P newex 168 99 34 196617 * 0.5;
#P newex 135 174 62 196617 urn;
#P newex 135 122 43 196617 uzi 8;
#P newex 91 252 40 196617 zl sort;
#P window linecount 2;
#P message 91 219 89 196617 9 26 17 29 15 14 18 20 3 12 25 19 10 4 13;
#P window linecount 1;
#P message 135 198 60 196617 append $1;
#P newex 91 273 52 196617 listfunnel;
#N funbuff 0;
#P newobj 69 296 42 196617 funbuff;
#P inlet 48 60 15 0;
#P inlet 69 60 15 0;
#P outlet 135 318 15 0;
#P outlet 69 318 15 0;
#P connect 2 0 12 0;
#P connect 3 0 4 0;
#P connect 5 0 4 0;
#P connect 12 2 4 0;
#P connect 12 0 4 0;
#P connect 4 0 0 0;
#P connect 12 4 7 0;
#P connect 12 1 7 0;
#P connect 6 0 7 0;
#P connect 7 0 8 0;
#P connect 8 0 5 0;
#P connect 12 3 9 0;
#P connect 9 0 10 0;
#P connect 13 0 10 0;
#P connect 10 0 6 0;
#P connect 8 0 1 0;
#P connect 9 1 13 0;
#P connect 15 0 11 0;
#P connect 11 0 9 1;
#P connect 15 0 14 0;
#P connect 14 0 10 1;
#P connect 15 0 14 1;
#P pop;
#P newobj 59 256 64 196617 p rand_fun;
#P newex 101 50 97 196617 r randrum_mlength;
#B color 2;
#P newex 140 106 97 196617 s randrum_mlength;
#B color 2;
#P newex 142 66 60 196617 loadmess 8;
#P window linecount 2;
#P comment 128 323 46 196617 beat list out;
#P window linecount 1;
#P newex 265 95 55 196617 sel 1 bang;
#P newex 207 83 21 196617 – 1;
#P number 71 138 26 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 50 324 46 196617 beats out;
#P window linecount 2;
#P comment 282 70 68 196617 reset random beats;
#P comment 57 67 30 196617 ticks in;
#P window linecount 1;
#P newex 59 185 27 196617 t b 1;
#P message 95 135 14 196617 0;
#P number 59 236 26 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 59 162 27 196617 sel;
#P newex 59 212 45 196617 accum;
#N counter 8;
#X flags 0 0;
#P newobj 59 110 66 196617 counter 8;
#P number 59 283 26 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 141 87 24 9 0 0 1 3 198 0 0 173 173 173 222 222 222 0 0 0;
#P window linecount 2;
#P comment 222 62 46 196617 measure length;
#P window linecount 1;
#P comment 183 312 46 196617 count out;
#N comlet ticks in;
#P inlet 59 90 15 0;
#N comlet measure length;
#P inlet 207 63 15 0;
#N comlet generate pattern/reset;
#P inlet 265 75 15 0;
#P outlet 59 184 15 0;
#P outlet 127 292 15 0;
#P connect 4 0 9 0;
#P connect 9 0 11 0;
#P connect 11 0 1 0;
#P connect 11 0 14 0;
#P connect 14 0 10 0;
#P connect 13 0 10 0;
#P connect 10 0 12 0;
#P connect 12 0 25 0;
#P connect 25 0 8 0;
#P connect 9 0 18 0;
#P fasten 8 0 11 1 64 309 106 309 106 157 81 157;
#P connect 14 1 10 1;
#P connect 9 2 13 0;
#P connect 24 0 9 3;
#P connect 20 1 25 1;
#P connect 24 0 9 4;
#P connect 25 1 0 0;
#P connect 7 0 23 0;
#P fasten 20 0 7 0 270 114 261 114 261 84 146 84;
#P connect 22 0 7 0;
#P connect 19 0 7 0;
#P connect 9 0 26 0;
#P connect 3 0 19 0;
#P connect 2 0 20 0;
#P pop;
#P newobj 134 201 111 196618 p randrum;
#B color 1;
#P window linecount 6;
#P comment 23 99 100 196618 set the number of beats (measure length). max 32 for the sake of this patch , but it can be a lot.;
#P window linecount 2;
#P comment 14 38 193 196618 randrum: this subpatch generates and plays a random rhythmic pattern.;
#P window linecount 1;
#P newex 184 233 66 196618 prepend set;
#P window linecount 3;
#P comment 40 226 64 196618 bangs come out left outlet ->;
#P connect 18 0 16 0;
#P connect 16 0 17 0;
#P connect 20 0 19 0;
#P connect 24 1 7 0;
#P connect 17 0 7 0;
#P fasten 12 0 15 0 99 333 81 333;
#P connect 14 0 15 0;
#P connect 13 0 15 0;
#P fasten 23 0 20 0 258 408 90 408;
#P fasten 4 0 8 0 139 231 99 231;
#P connect 8 0 12 0;
#P fasten 12 0 15 1 99 335 103 335;
#P connect 5 0 4 0;
#P connect 27 0 4 1;
#P connect 26 0 4 1;
#P connect 25 0 4 1;
#P connect 4 1 1 0;
#P fasten 24 0 18 0 281 294 251 294 251 256 189 256;
#P connect 1 0 18 0;
#P connect 6 0 5 0;
#P fasten 10 0 4 2 206 197 239 197;
#P fasten 4 2 23 0 239 227 258 227;
#P fasten 10 0 24 0 206 253 281 253;
#P pop;

#102722
Apr 25, 2007 at 11:10am

John Cobbett schrieb:
> never made a real help.pat before, this example should work.

nice, your on the best way….
we should eliminate the noob in the subject now…

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com

#102723

You must be logged in to reply to this topic.