Forums > MaxMSP

zigzag~ bug (or my confusion?) and some meanderings

May 19, 2007 | 6:08 pm

Hi Max/MSP wizards,

I’ve been working with setting points via a function editor to create a
signal controlled envelope, and attempting to do so without triggering
the envelope as I set zigzag~ (seems like the web forum is down, but if
it helps I got this idea from the thread with the subject "setting
parameters with zigzag~").

Basically, I’m trying to use the setindex message to set index points
dynamically with zigzag~. However, unless there is a point already in
existence, it seems that setindex will not set that point. And here is
where my potential bug is coming in: it appears that with the setindex
message the x-value (format is ‘setindex ‘)
is not getting set:

#P window setfont "Sans Serif" 9.;
#P window linecount 4;
#P comment 279 173 136 196617 < -- then click this and print again. On my
machine , x-value doesn’t get changed. Is this a bug?;
#P window linecount 2;
#P comment 215 129 100 196617 < -- click this , then print to see...;
#P window linecount 1;
#P message 49 171 46 196617 delete 0;
#P newex 49 100 30 196617 t b b;
#P newex 49 68 48 196617 loadbang;
#P message 153 130 43 196617 1. 5.;
#P message 49 130 42 196617 mode 1;
#P message 106 130 32 196617 print;
#P message 184 171 81 196617 setindex 0 0. 0.;
#P newex 107 221 53 196617 zigzag~;
#P window linecount 5;
#P comment 110 41 100 196617 on load it will initialize to mode 1 (what
I am using) and then print out initial state.;
#P connect 6 0 7 0;
#P connect 7 1 4 0;
#P connect 7 1 8 0;
#P connect 7 0 3 0;
#P connect 2 0 1 0;
#P connect 3 0 1 0;
#P connect 4 0 1 0;
#P connect 5 0 1 0;
#P connect 8 0 1 0;
#P window clipboard copycount 11;

I’m using Max/MSP 4.6.3 on a MacBook Pro 2.33 GHz Intel Core 2 Duo, if
that matters. Is this a bug, or am I confused about zigzag~
functioning, or something else? I did note that the printout lists
y-value then delta-x…so maybe that’s a clue to my confusion, but I’d
appreciate an explanation.

So, besides this, does anyone have a sort of archetypal zig-zag~
amplitude envelope patch or methodology that works particularly well for
real-time manipulation of envelopes? What I’ve got is pretty okay, but
feels a bit hacky and occasionally gives me an audible glitch when I
reset the envelope (this patch includes also a simple envelope driven by
adsr~ basically lifted from that object’s help file):

#P window setfont "Sans Serif" 9.;
#P number 837 492 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 837 431 15 0;
#P window linecount 1;
#P newex 837 450 52 196617 metro 10;
#N counter 1 0 27;
#X flags 0 0;
#P newobj 837 471 77 196617 counter 1 0 27;
#P message 837 511 87 196617 setindex $1 0. 0.;
#P number 837 392 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 859 153 40 196617 t b b b;
#P toggle 837 331 15 0;
#P newex 837 350 52 196617 metro 10;
#N counter 1 0 27;
#X flags 0 0;
#P newobj 837 371 77 196617 counter 1 0 27;
#P message 837 411 87 196617 setindex $1 0. 0.;
#P flonum 329 304 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 38 113 15 0;
#P button 62 113 15 0;
#P button 188 113 15 0;
#P window setfont "Sans Serif" 24.;
#P window linecount 2;
#P message 62 43 117 196632 ZIGZAG~ Envelope;
#P window linecount 1;
#P message 1 43 51 196632 OFF;
#P window linecount 2;
#P message 188 43 112 196632 ADSR~ Envelope;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 662 132 48 196617 loadbang;
#P window setfont "Sans Serif" 12.;
#P message 85 132 18 196620 2;
#P message 62 132 18 196620 1;
#P message 38 132 19 196620 0;
#P window setfont "Sans Serif" 9.;
#P newex 38 161 62 196617 selector~ 2;
#P comment 450 323 65 196617 release (ms);
#P comment 430 303 212 196617 sustain (factor of amplitude – ie , 0.6 =
60%);
#P comment 416 282 59 196617 decay (ms);
#P flonum 404 323 42 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 390 303 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 376 282 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 362 261 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 400 261 61 196617 attack (ms);
#P user scope~ 318 382 448 512 8 3 8 -1. 1. 0 0. 0 0. 102 255 51 135 135
135 0;
#P newex 318 326 39 196617 >~ 0.5;
#P newex 318 282 40 196617 +~ 1.;
#P newex 318 261 40 196617 *~ -1.;
#P newex 348 350 66 196617 adsr~;
#P flonum 270 284 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 62 342 27 196617 +~;
#P newex 62 314 64 196617 cycle~ 440.;
#P window linecount 2;
#P message 709 289 250 196617 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
#P window linecount 1;
#P newex 662 350 53 196617 zigzag~;
#P message 1094 175 33 196617 clear;
#P newex 1007 543 51 196617 print env;
#P newex 1007 488 63 196617 pack 0 0. 0.;
#P newex 1007 465 64 196617 unpack 0. 0.;
#P message 1050 413 14 196617 0;
#P newex 1007 413 27 196617 t b l;
#P message 1081 371 41 196617 zlclear;
#N counter;
#X flags 0 0;
#P newobj 1007 439 66 196617 counter;
#P button 978 314 15 0;
#P user gswitch2 978 334 39 32 0 0;
#P newex 1007 371 69 196617 prepend 0. 0.;
#P newex 1007 390 55 196617 zl group 2;
#P flonum 240 342 56 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 240 314 40 196617 / 1.25;
#P newex 1007 517 86 196617 prepend setindex;
#P message 662 289 42 196617 mode 1;
#P message 719 350 32 196617 print;
#P user scope~ 662 382 792 512 8 3 8 -1. 1. 0 0. 0 0. 102 255 51 135 135
135 0;
#P flonum 318 97 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 318 132 83 196617 phasor~ 0.5;
#P newex 108 368 58 196617 cycle~ 1.;
#P number 1040 124 80 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 1040 148 70 196617 setdomain $1;
#P flonum 62 284 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P user ezdac~ 62 603 106 636 0;
#P button 979 106 48 0;
#P user function 979 196 1179 296 1 1 0 0;
#X frgb 82 82 82;
#X brgb 204 204 204;
#X rgb2 85 85 85;
#X rgb3 255 255 255;
#X rgb4 0 0 0;
#X rgb5 0 0 0;
#X add 0. 0. 0;
#X add 16.356382 0.293333 0;
#X add 26.170212 0.986667 0;
#X add 29.441488 0. 0;
#X add 91.595741 0.746667 0;
#X add 143.936172 0.666667 0;
#X add 245.345734 0. 0;
#X add 248.61702 0.56 0;
#X add 592.101074 0. 0;
#X domain 615.;
#X range 0. 1.;
#X done;
#P newex 62 393 27 196617 *~;
#P user gain~ 62 460 24 100 158 0 1.071519 7.94321 10.;
#P newex 62 368 27 196617 *~;
#P newex 148 314 70 196617 phasor~ 440.;
#P window linecount 4;
#P comment 874 87 100 196617 hit this bang to send the envelope after
you’ve tweaked the function editor –>;
#P window linecount 3;
#P comment 119 253 100 196617 real simple amplitude modulation synth;
#P connect 57 0 61 0;
#P connect 61 0 52 0;
#P connect 52 0 51 0;
#P connect 53 0 51 0;
#P connect 54 0 51 0;
#P connect 58 0 60 0;
#P connect 60 0 53 0;
#P connect 9 0 35 0;
#P connect 35 0 36 0;
#P connect 36 0 3 0;
#P connect 3 0 5 0;
#P connect 5 0 4 0;
#P connect 4 0 8 0;
#P connect 33 0 51 1;
#P connect 2 0 36 1;
#P connect 51 0 3 1;
#P fasten 12 0 5 1 113 389 84 389;
#P fasten 59 0 54 0 193 129 90 129;
#P connect 38 0 51 2;
#P connect 4 0 8 1;
#P fasten 20 0 12 0 245 362 113 362;
#P connect 9 0 2 0;
#P connect 56 0 59 0;
#P connect 9 0 19 0;
#P connect 19 0 20 0;
#P connect 37 0 19 1;
#P connect 14 0 13 0;
#P connect 13 0 39 0;
#P connect 39 0 40 0;
#P connect 40 0 41 0;
#P connect 41 0 42 0;
#P connect 62 0 41 1;
#P connect 41 0 38 0;
#P connect 44 0 38 1;
#P connect 45 0 38 2;
#P connect 46 0 38 3;
#P connect 47 0 38 4;
#P connect 55 0 17 0;
#P connect 18 0 33 0;
#P connect 69 0 33 0;
#P connect 17 0 33 0;
#P connect 16 0 33 0;
#P connect 34 0 33 0;
#P connect 13 0 33 0;
#P connect 63 0 33 0;
#P connect 33 0 15 0;
#P connect 55 0 34 0;
#P connect 7 0 66 0;
#P connect 67 2 66 0;
#P connect 66 0 65 0;
#P connect 65 0 64 0;
#P connect 64 0 68 0;
#P connect 68 0 63 0;
#P connect 70 1 72 0;
#P connect 72 0 71 0;
#P connect 71 0 70 0;
#P connect 70 0 73 0;
#P connect 73 0 69 0;
#P connect 64 1 67 0;
#P connect 6 1 24 0;
#P connect 24 0 23 0;
#P fasten 10 0 6 0 1045 181 984 181;
#P connect 32 0 6 0;
#P connect 67 0 6 0;
#P connect 6 1 23 1;
#P connect 23 1 22 0;
#P connect 26 0 21 0;
#P connect 22 0 21 0;
#P connect 21 0 27 0;
#P connect 27 0 25 0;
#P connect 27 1 29 0;
#P connect 25 0 30 0;
#P connect 30 0 18 0;
#P connect 18 0 31 0;
#P connect 29 0 30 1;
#P connect 28 0 25 2;
#P connect 11 0 10 0;
#P hidden connect 7 0 28 0;
#P connect 29 1 30 2;
#P window clipboard copycount 74;

Thanks for any assistance!

Best,
Dave


May 21, 2007 | 11:20 pm

Dave Della Costa schrieb:
> Basically, I’m trying to use the setindex message to set index points
> dynamically with zigzag~. However, unless there is a point already in
> existence, it seems that setindex will not set that point. And here is
> where my potential bug is coming in: it appears that with the setindex
> message the x-value (format is ‘setindex ‘)
> is not getting set:

Only if the time is set to zero, the time seems to be ignored. Other
times work.
One could call this a bug, you might want to set one segment to 0
instead of deleting it… But it would be the same as deleting, at least
if there is another element behind it…

I doubt that it would make a problem for you project though… ;-)

Stefan


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


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