Forums > MaxMSP

plugmultiparam and function

November 12, 2006 | 1:11 am

could anyone recommend a simple method of using the function object with plugmultiparam within a pluggo ? i’m having trouble parsing the messages from function to and from plugmultiparam…and it’s doing my nut in…

thanks in advance,

don


November 12, 2006 | 11:29 am

I also had a look at plugmultiparam for use with function. But ended up
with a different solution, because (as i remember it) parameter values
from plugmultiparam is not being send out the fourth outlet of vst~.

Here’s what i got:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#N vpatcher 359 160 1465 682;
#P window setfont "Sans Serif" 9.;
#P newex 56 265 32 196617 del 5;
#N pp 19;
#P newobj 536 185 35 196617 pp 19;
#N pp 18;
#P newobj 462 185 35 196617 pp 18;
#N pp 17;
#P newobj 388 185 35 196617 pp 17;
#N pp 16;
#P newobj 314 185 35 196617 pp 16;
#N pp 15;
#P newobj 240 185 35 196617 pp 15;
#N pp 14;
#P newobj 166 185 35 196617 pp 14;
#N pp 13;
#P newobj 92 185 35 196617 pp 13;
#P inlet 711 185 15 0;
#P message 711 388 48 196617 listdump;
#N pp 20;
#P newobj 610 185 35 196617 pp 20;
#P newex 506 185 27 196617 f;
#P newex 56 185 27 196617 f;
#P newex 581 185 27 196617 f;
#P outlet 56 470 15 0;
#P newex 138 388 55 196617 zl group 2;
#P newex 431 185 27 196617 f;
#P newex 356 185 27 196617 f;
#P newex 281 185 27 196617 f;
#P newex 206 185 27 196617 f;
#P newex 131 185 27 196617 f;
#P newex 56 231 29 196617 t b f;
#P inlet 26 27 15 0;
#P newex 26 50 184 196617 unpack 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.;
#P message 56 388 79 196617 fix 0 1 , fix 5 1;
#P newex 56 327 54 196617 t b l clear;
#P newex 56 304 174 196617 pack 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0.;
#P connect 4 0 3 0;
#P connect 19 0 14 0;
#P connect 3 2 14 0;
#P connect 14 0 5 0;
#P connect 5 0 26 0;
#P connect 26 0 0 0;
#P connect 0 0 1 0;
#P connect 1 0 2 0;
#P fasten 1 2 12 0 209 381 209 408;
#P connect 2 0 12 0;
#P connect 11 0 12 0;
#P connect 17 0 12 0;
#P fasten 5 1 0 2 80 262 89 262;
#P connect 14 0 19 0;
#P connect 6 0 0 3;
#P connect 7 0 0 4;
#P connect 8 0 0 5;
#P connect 20 0 6 0;
#P connect 3 3 6 0;
#P connect 1 1 11 0;
#P connect 9 0 0 6;
#P connect 10 0 0 7;
#P connect 6 0 20 0;
#P connect 15 0 0 8;
#P connect 13 0 0 9;
#P connect 21 0 7 0;
#P connect 3 4 7 0;
#P connect 7 0 21 0;
#P connect 22 0 8 0;
#P connect 3 5 8 0;
#P connect 8 0 22 0;
#P connect 23 0 9 0;
#P connect 3 6 9 0;
#P connect 9 0 23 0;
#P connect 24 0 10 0;
#P connect 3 7 10 0;
#P connect 10 0 24 0;
#P connect 25 0 15 0;
#P connect 3 8 15 0;
#P connect 15 0 25 0;
#P connect 16 0 13 0;
#P connect 3 9 13 0;
#P connect 13 0 16 0;
#P connect 18 0 17 0;
#P pop;
#P newobj 372 146 33 196617 p pps;
#P user function 14 111 321 190 0 1 1 0;
#X frgb 0 0 0;
#X brgb 219 229 151;
#X rgb2 28 35 138;
#X rgb3 0 0 0;
#X rgb4 57 175 155;
#X rgb5 0 0 0;
#X add 0. 0. 1;
#X add 0.159322 0.149254 0;
#X add 0.250847 0.746269 0;
#X add 0.338983 0.134328 0;
#X add 0.650847 0.791045 0;
#X add 1. 0. 1;
#X domain 1.;
#X range 0. 1.;
#X done;
#P hidden connect 1 0 0 0;
#P hidden connect 0 2 1 0;
#P hidden connect 0 3 1 1;
#P window clipboard copycount 2;

12/11/06, kl. 2:11 +0100 , skrev donovan sellings:

>
>could anyone recommend a simple method of using the function object with
>plugmultiparam within a pluggo ? i’m having trouble parsing the messages
>from function to and from plugmultiparam…and it’s doing my nut in…
>
>thanks in advance,
>
>don
>


November 12, 2006 | 1:43 pm

thanks for that but i’m not using vst~ currently plus i would like to use a varying number of breakpoints and your solution appears to be for a fixed number. you have given me some pointers though…

from a previous post on this –

"One thing you could try is to use plugmultiparam to store a list of the breakpoints. The trick though is to use the first element of the list to store the number of breakpoints in the list. You can then use zl slice etc. to trim things down and work with the breakpoints as you wish."

i’m still a bit confused…


February 11, 2007 | 1:40 pm

Hello,

I just found your message as I’m try to do something similar. My initial solution was similar to Jakob’s but this doesn’t allow the saving of the sustain points. Although cmd-click (or ctrl-click on Windows) doesn’t work in Pluggo and brings up a menu (in Cubase in any case) so you can’t add sustain points the way you can in Max.

My second solution was to use autopattr to store the function then query the autopattr, then you can get sustain point info (and domain and range info if you want it although I ignore it in this example).

You need this saved as a patcher which is loaded in the main patch as a bpatcher:
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#N vpatcher 10 59 457 299;
#P outlet 43 153 15 0;
#P inlet 43 42 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 110 101 93 196617 size $1;
#P button 110 81 15 0;
#P window linecount 0;
#P comment 134 40 196 196617 ensures the multislider is the correct size before plugmultiparams messages come in;
#P connect 2 0 4 0;
#P connect 3 0 4 0;
#P connect 3 0 1 0;
#P connect 1 0 2 0;
#P pop;
#P newobj 521 274 71 196617 p cookparams;
#N vpatcher 40 104 702 527;
#P window setfont "Sans Serif" 9.;
#P comment 268 335 143 196617 resize the list to the size of the plugmultiparam;
#P window linecount 1;
#N vpatcher 29 89 396 382;
#P window setfont "Sans Serif" 9.;
#P newex 188 142 103 196617 zl slice $1;
#P message 85 141 67 196617 size $1;
#P newex 85 98 113 196617 t b l;
#P outlet 85 199 15 0;
#P inlet 85 56 15 0;
#P comment 126 49 125 196617 ensures the list is exactly $1 items in length;
#P connect 1 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 2 0;
#P fasten 5 0 2 0 193 176 90 176;
#P connect 3 1 5 0;
#P pop;
#P newobj 204 333 61 196617 p resizelist;
#P window linecount 2;
#P comment 287 256 56 196617 build the list;
#P window linecount 1;
#P comment 299 215 236 196617 scale the sustain argument down to between 0…1;
#P outlet 204 374 15 0;
#P window linecount 0;
#P message 204 298 336 196617 0. 0. 0. 0.044983 1. 0. 0.802768 1. 0. 1. 0. 0.;
#P newex 204 253 78 196617 prepend append;
#P window linecount 1;
#N vpatcher 40 104 232 385;
#P window setfont "Sans Serif" 9.;
#P newex 101 115 27 196617 / 2.;
#P outlet 51 184 15 0;
#P window linecount 1;
#P newex 51 143 61 196617 pack f f f;
#P window linecount 0;
#P newex 51 86 60 196617 unpack f f i;
#P inlet 51 52 15 0;
#P connect 0 0 1 0;
#P connect 1 0 2 0;
#P connect 2 0 3 0;
#P connect 1 1 2 1;
#P connect 1 2 4 0;
#P connect 4 0 2 2;
#P pop;
#P newobj 204 218 90 196617 p scalesustain2-1;
#P window linecount 0;
#P newex 61 70 215 196617 t b l set;
#P window linecount 1;
#P comment 255 180 132 196617 points are in triplets;
#P window linecount 0;
#P newex 204 177 47 196617 zl iter 3;
#P newex 163 120 51 196617 zl slice 3;
#P inlet 61 39 15 0;
#P comment 217 120 210 196617 1st 3 args are [domain rangemin rangemax] so ignore these;
#P connect 1 0 5 0;
#P connect 5 1 2 0;
#P connect 2 1 3 0;
#P connect 3 0 6 0;
#P connect 6 0 7 0;
#P fasten 5 0 8 0 66 286 209 286;
#P fasten 5 2 8 0 270 107 142 107 142 277 209 277;
#P connect 7 0 8 0;
#P connect 8 0 12 0;
#P connect 12 0 9 0;
#P pop;
#P newobj 303 297 122 196617 p cooklist-to_multislider;
#P newex 303 274 73 196617 route function;
#P objectname u228000007;
#P message 240 224 60 196617 getfunction;
#P newex 240 246 73 196617 autopattr test;
#X prestore function 15 0 1. 0. 1. 0. 0. 0 0.044983 1. 0 0.802768 1. 0 1. 0. 0;
#P objectname test;
#N vpatcher 38 406 591 841;
#P window setfont "Sans Serif" 9.;
#P window linecount 0;
#P newex 24 60 47 196617 zl iter 3;
#P window linecount 1;
#P comment 120 55 192 196617 from the plugmultiparam object;
#P comment 120 42 192 196617 this strips off any trailing zeros;
#P window linecount 0;
#N vpatcher 40 104 240 387;
#P window setfont "Sans Serif" 9.;
#P newex 105 119 27 196617 * 2;
#P outlet 55 188 15 0;
#P window linecount 1;
#P newex 55 147 60 196617 pack f f i;
#P window linecount 0;
#P newex 55 90 61 196617 unpack f f f;
#P inlet 55 56 15 0;
#P connect 0 0 1 0;
#P connect 1 0 2 0;
#P connect 2 0 3 0;
#P connect 1 1 2 1;
#P connect 1 2 4 0;
#P connect 4 0 2 2;
#P pop;
#P newobj 259 115 90 196617 p scalesustain1-2;
#P window linecount 1;
#P newex 259 343 63 196617 prepend add;
#P window linecount 0;
#P newex 41 197 158 196617 if $f1==0. then 0. else out2 bang;
#P newex 41 265 46 196617 select 1;
#P newex 41 241 190 196617 > -1.;
#P message 432 97 22 196617 -1.;
#P inlet 432 64 15 0;
#P newex 24 122 61 196617 unpack f f f;
#P message 259 319 160 196617 1. 0. 0;
#P newex 259 140 62 196617 prepend set;
#P newex 24 89 245 196617 t l l;
#P outlet 259 373 15 0;
#P inlet 24 35 15 0;
#P window linecount 1;
#P newex 24 154 27 196617 t f f;
#P connect 1 0 16 0;
#P connect 16 0 3 0;
#P connect 3 0 6 0;
#P connect 6 0 0 0;
#P connect 0 1 11 0;
#P connect 11 0 9 0;
#P connect 9 0 10 0;
#P fasten 8 0 9 1 437 168 226 168;
#P fasten 0 0 9 1 29 180 226 180;
#P connect 3 1 13 0;
#P connect 13 0 4 0;
#P fasten 11 1 5 0 194 226 264 226;
#P connect 4 0 5 0;
#P fasten 10 0 5 0 46 300 264 300;
#P connect 5 0 12 0;
#P connect 12 0 2 0;
#P connect 7 0 8 0;
#P pop;
#P newobj 517 145 109 196617 p cooklist-to_function;
#P user multiSlider 521 331 279 85 0. 1. 12 2681 15 0 0 5 3 60 0;
#M frgb 0 0 0;
#M brgb 255 255 255;
#M rgb2 99 99 99;
#M rgb3 0 0 0;
#M rgb4 37 52 91;
#M rgb5 74 105 182;
#M rgb6 112 158 18;
#M rgb7 149 211 110;
#M rgb8 187 9 201;
#M rgb9 224 62 37;
#M rgb10 7 114 128;
#P window linecount 5;
#P comment 420 506 111 196617 this loop causes the function to dump its envelope via autopattr when it has been edited using the mouse;
#P comment 19 420 115 196617 the 1ms duration just makes things easier for pluggo/vst parameters by keeing them between 0…1;
#P comment 328 85 152 196617 this takes lists in from plugmultiparam , clears the current envelope , then rebuilds the new envelope by splitting the list into value pairs;
#P window linecount 1;
#P newex 517 106 239 196617 t l clear b;
#N comlet plugmultiparam input;
#P inlet 521 239 15 0;
#N comlet line~ output;
#P outlet 148 534 15 0;
#N comlet plugmultiparam output;
#P outlet 521 447 15 0;
#P message 225 109 70 196617 setdomain $1;
#P newex 195 76 41 196617 t 1. b f;
#N comlet length of envelope to trigger in ms (float);
#P inlet 195 46 15 0;
#P user function 156 340 457 491 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 0.044983 1. 0;
#X add 0.802768 1. 0;
#X add 1. 0. 0;
#X domain 1.;
#X range 0. 1.;
#X done;
#P objectname function;
#P window linecount 6;
#P comment 18 342 115 196617 this function is set to a domain (duration) of 1ms – it is scaled to the desired duration when it is triggered (then set back to 1ms);
#P window linecount 4;
#P comment 90 69 101 196617 this part sets the duration of the envelope then sets it back to 1ms again;
#P window linecount 2;
#P comment 654 300 175 196617 multislider is needed for interface with the plugmultiparam object;
#P fasten 10 2 15 1 750 134 621 134;
#P fasten 14 0 10 0 526 433 506 433 506 91 522 91;
#P connect 14 0 7 0;
#P fasten 19 0 14 0 308 323 526 323;
#P connect 20 0 14 0;
#P connect 9 0 20 0;
#P connect 10 0 15 0;
#P connect 18 0 19 0;
#P connect 16 3 18 0;
#P connect 17 0 16 0;
#P fasten 3 3 17 0 452 500 467 500 467 207 245 207;
#P connect 5 2 6 0;
#P fasten 5 0 6 0 200 101 230 101;
#P connect 4 0 5 0;
#P connect 16 0 3 0;
#P connect 6 0 3 0;
#P connect 5 1 3 0;
#P fasten 10 1 3 0 636 188 161 188;
#P fasten 15 0 3 0 522 174 161 174;
#P fasten 3 1 8 0 258 519 153 519;
#P window clipboard copycount 21;

Then here’s the main patch:
#P window setfont "Sans Serif" 9.;
#P window linecount 2;
#P comment 251 224 176 196617 size of plugmultiparam (50 here) is the 1st argument to plugfunction2;
#P window linecount 1;
#P comment 6 4 373 196617 panel to measure 6 pxels below object palette for pluggo interface aligning;
#P comment 33 186 155 196617 function set to 1ms duration;
#P message 477 192 59 196617 capture $1;
#P button 447 112 15 0;
#P newex 447 149 40 196617 Uzi 64;
#P newex 56 282 32 196617 line~;
#P newex 56 396 48 196617 plugout~;
#P newex 140 286 102 196617 t i b;
#P newex 140 331 40 196617 cycle~;
#P newex 140 309 31 196617 mtof;
#P newex 140 264 51 196617 stripnote;
#P newex 140 241 92 196617 midiparse;
#P newex 140 219 55 196617 plugmidiin;
#P newex 56 358 94 196617 *~;
#P newex 56 235 52 196617 route list;
#P user panel 0 21 26 6;
#X brgb 191 191 191;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P bpatcher -1 27 301 151 -156 -340 plugfunction2.mxb 0 50;
#P objectname plugfunction2.mxb;
#P message 548 231 45 196617 recall 2;
#P message 548 216 45 196617 recall 1;
#P message 495 231 53 196617 capture 2;
#P message 495 216 53 196617 capture 1;
#N plugconfig;
#C useviews 1 1 1 1;
#C numprograms 64;
#C preempt 1;
#C sigvschange 1;
#C sigvsdefault 32;
#C setsize 301 178;
#C defaultview Interface 0 0 0;
#C dragscroll 1;
#C noinfo;
#C setprogram 1 "Program 1" 0 0. 0. 0. 0.031142 1. 0. 0.785467 1. 0. 1. 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.;
#C setprogram 2 "Program 2" 0 0. 0. 0. 0.044983 1. 0. 0.283737 0.634921 0. 0.813149 0.634921 1. 1. 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.;
#C uniqueid 128 109 7;
#C initialpgm 1;
#C synth;
#P newobj 477 267 55 196617 plugconfig;
#P message 232 312 34 196617 1000;
#P newex 290 190 103 196617 plugmultiparam 1 50;
#P window linecount 3;
#P comment 441 46 179 196617 this is a bpatcher using a patch called "plugfunction2" , – I’ve embedded the bpatcher in this example;
#P comment 467 101 164 196617 store the same preset in all 64 programs since empty functions will be a single point at [0. 0.];
#P window linecount 2;
#P comment 269 309 124 196617 trigger and time scale factor for function;
#P window linecount 1;
#P comment 355 42 129 196617 < --------------;
#P comment 121 390 100 196617 simple synth test;
#P connect 11 0 7 0;
#P connect 10 0 7 0;
#P connect 9 0 7 0;
#P connect 8 0 7 0;
#P connect 26 0 7 0;
#P connect 24 2 26 0;
#P connect 25 0 24 0;
#P connect 12 1 5 0;
#P fasten 5 0 12 1 295 220 409 220 409 14 295 14;
#P connect 21 1 6 0;
#P connect 20 0 15 1;
#P connect 19 0 20 0;
#P connect 21 0 19 0;
#P connect 18 0 21 0;
#P connect 17 0 18 0;
#P connect 16 0 17 0;
#P connect 15 0 22 1;
#P connect 15 0 22 0;
#P connect 23 0 15 0;
#P connect 14 0 23 0;
#P connect 12 0 14 0;
#P fasten 6 0 12 0 237 345 435 345 435 24 4 24;
#P window clipboard copycount 30;

regards
Martin


February 11, 2007 | 1:48 pm

Sorry, – I forgot to say you should save the first patch as "plugfunction2.mxb"

M


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