Forums > MaxMSP

[sharingisfun] a decent pattrstorage interface


March 1, 2008 | 5:36 pm

Here’s a patch for pattrstorage that gives it a nice menu, increment/decrement buttons, and editable names. Read the comments for more description, but the result is that it makes it easy to integrate preset storage and recall in your patch.
It’s merely "decent" because it takes up some screen real estate with the patch cords and subpatches. But it works :)

Enjoy,

Peter Nyboer.

#P window setfont "Sans Serif" 10.;
#P window linecount 3;
#P comment 420 307 297 196618 ** to change the number of presets , you’ll have to re-initialize the menu in [p menumaker] and change the clipping values in [p incdec];
#P window setfont "Sans Serif" 9.;
#P window linecount 4;
#P comment 67 416 99 196617 uses scripting to "turn on" name editing , and turn it off when done;
#P window setfont Arial 9.;
#P window linecount 1;
#P hidden newex 584 452 19 131137545 t b;
#P window setfont "Sans Serif" 12.;
#P message 583 429 215 196620 http://www.lividinstruments.com;
#P window setfont "Sans Serif" 9.;
#P hidden message 603 476 261 196617 ; max launchbrowser http://www.lividinstruments.com;
#P window setfont "Sans Serif" 10.;
#P comment 566 411 297 196618 pnyboer@slambassador.com;
#P comment 557 394 297 196618 patch by peter nyboer;
#P window linecount 2;
#P comment 419 275 297 196618 When a pattr xml file is loaded , preset 1 is automatically loaded.;
#P window setfont Arial 9.;
#P window linecount 1;
#P newex 350 487 59 131137545 prepend set;
#P window setfont "Sans Serif" 9.;
#N vpatcher 10 59 178 203;
#P window setfont Arial 9.;
#P newex 35 74 33 131137545 zl reg;
#P newex 35 52 27 131137545 t b i;
#P window setfont "Sans Serif" 9.;
#P newex 75 74 27 196617 + 1;
#P inlet 35 32 15 0;
#P inlet 67 32 15 0;
#P outlet 75 96 15 0;
#P outlet 35 95 15 0;
#P connect 3 0 5 0;
#P connect 5 0 6 0;
#P connect 6 0 0 0;
#P connect 2 0 6 1;
#P fasten 5 1 4 0 57 71 80 71;
#P connect 4 0 1 0;
#P pop;
#P newobj 153 327 74 196617 p menumanage;
#P window setfont "Sans Serif" 10.;
#P window linecount 2;
#P comment 419 236 297 196618 Use the down-facing triangle to access the menu and change to any preset , rather than using the inc/dec buttons.;
#P window linecount 3;
#P comment 419 185 297 196618 Click on the name to edit the name. Hit "enter" to change it or "esc" to leave it untouched. If you are editing a name , then change the preset , the name is left unedited.;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 423 71 297 196617 …though it is a bit messy :(;
#P window setfont "Sans Serif" 10.;
#P window linecount 4;
#P comment 419 123 297 196618 Use the inc/dec ("< <" and ">>") buttons to navigate through presets. When you change your preset , current settings are first stored in the preset you are "leaving" , and then the preset you have changed to is loaded.;
#P window linecount 2;
#P comment 419 92 297 196618 Provides 32 preset slots** , an easy way to reaname presets , and store the preset names in the pattrstorage.;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 58 268 18 196617 < <;
#P message 188 268 18 196617 >>;
#P window setfont Arial 9.;
#P newex 197 65 40 131137545 pattr;
#X prestore 1 0 -0.825;
#P objectname u566000003;
#P newex 154 64 40 131137545 pattr;
#X prestore 1 0 -0.85;
#P objectname u073000004;
#P newex 111 63 40 131137545 pattr;
#X prestore 1 0 -0.85;
#P objectname u028000005;
#P newex 68 62 40 131137545 pattr;
#X prestore 1 0 -0.8;
#P objectname u693000006;
#P newex 25 61 40 131137545 pattr;
#X prestore 1 0 -1.;
#P objectname u460000007;
#P window setfont "Sans Serif" 9.;
#N vpatcher 10 59 449 329;
#P window setfont Arial 9.;
#P window linecount 1;
#P newex 237 93 45 131137545 onebang;
#N comlet bang to hide textedit;
#P inlet 241 55 15 0;
#N comlet bang to show textedit;
#P inlet 208 49 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 176 148 33 196617 desel;
#P newex 54 50 29 196617 t 1 l;
#P newex 109 94 40 196617 t 0 b b;
#P newex 54 73 47 196617 gate 1 1;
#P window setfont Arial 9.;
#P newex 54 95 50 131137545 route text;
#P window setfont "Sans Serif" 9.;
#P newex 109 71 38 196617 sel 27;
#P inlet 54 30 15 0;
#P inlet 109 51 15 0;
#P outlet 176 211 15 0;
#P outlet 54 126 15 0;
#P window setfont Arial 9.;
#P window linecount 0;
#P newex 226 137 19 131137545 t b;
#P window setfont "Sans Serif" 9.;
#P message 225 174 187 196617 script hide text , script show textbutton;
#P message 208 158 296 196617 script show text , script send text select , script hide textbutton;
#P connect 6 0 11 0;
#P connect 11 0 9 0;
#P fasten 10 0 9 0 114 156 32 149 32 70 32 69 59 69;
#P connect 9 0 8 0;
#P connect 8 0 3 0;
#P connect 11 1 9 1;
#P connect 5 0 7 0;
#P connect 7 0 10 0;
#P fasten 10 1 12 0 129 114 181 114;
#P connect 12 0 4 0;
#P connect 1 0 4 0;
#P connect 0 0 4 0;
#P connect 13 0 0 0;
#P connect 2 0 1 0;
#P connect 15 0 2 0;
#P fasten 8 0 2 0 59 124 231 124;
#P fasten 10 2 2 0 144 124 231 124;
#P connect 14 0 15 0;
#P connect 13 0 15 1;
#P pop;
#P newobj 81 328 70 196617 p textmanage;
#N vpatcher 20 74 620 474;
#P window setfont Arial 9.;
#P newex 96 50 57 131137545 loadmess 1;
#P newex 65 76 38 131137545 bucket;
#P newex 50 50 40 131137545 t i i i;
#P window setfont "Sans Serif" 9.;
#P newex 65 124 118 196617 pack store 1 "Preset 1";
#P newex 65 99 27 196617 t b i;
#P message 50 162 95 196617 $1 , getslotname $1;
#P inlet 50 30 15 0;
#P inlet 173 104 15 0;
#P outlet 50 182 15 0;
#P connect 2 0 6 0;
#P connect 6 0 3 0;
#P connect 3 0 0 0;
#P connect 5 0 0 0;
#P connect 6 1 7 0;
#P connect 8 0 7 0;
#P connect 7 0 4 0;
#P connect 4 0 5 0;
#P fasten 4 1 5 1 87 120 124 120;
#P connect 1 0 5 2;
#P pop;
#P newobj 342 388 68 196617 p storerecall;
#N vpatcher 10 59 416 296;
#P window setfont "Sans Serif" 9.;
#P message 263 89 75 196617 initialize menu;
#P window setfont Arial 9.;
#P window linecount 1;
#P newex 263 109 44 131137545 t b clear;
#P newex 262 151 114 131137545 sprintf append Preset%ld;
#P newex 264 130 40 131137545 uzi 32;
#P window linecount 0;
#P newex 94 109 59 131137545 prepend set;
#P newex 94 89 27 131137545 – 1;
#P button 42 131 15 0;
#P newex 42 154 101 131137545 pak setitem 0 ;
#P newex 168 91 59 131137545 prepend set;
#P newex 94 70 83 131137545 unpack 0
;
#P newex 94 50 71 131137545 route slotname;
#P inlet 94 30 15 0;
#P inlet 181 35 15 0;
#P outlet 180 125 15 0;
#P outlet 42 175 15 0;
#P connect 8 0 7 0;
#P fasten 12 0 0 0 267 171 47 171;
#P fasten 13 1 0 0 302 150 47 150;
#P connect 7 0 0 0;
#P connect 10 0 0 0;
#P connect 10 0 7 1;
#P connect 3 0 4 0;
#P connect 4 0 5 0;
#P connect 5 0 9 0;
#P connect 9 0 10 0;
#P connect 2 0 7 2;
#P connect 5 1 6 0;
#P fasten 6 0 1 0 173 116 185 116;
#P connect 11 2 12 0;
#P connect 14 0 13 0;
#P connect 13 0 11 0;
#P pop;
#P newobj 81 235 69 196617 p menumaker;
#P window setfont Arial 9.;
#P newex 350 441 52 131137545 route read;
#N thispatcher;
#Q end;
#P newobj 81 397 56 131137545 thispatcher;
#P user ubutton 81 268 89 20 0 0;
#P objectname textbutton;
#P newex 350 461 19 131137545 t 1;
#P window setfont "Sans Serif" 9.;
#P message 469 379 30 196617 read;
#P message 429 379 35 196617 write;
#P number 284 297 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont Arial 10.;
#P hidden user textedit 81 268 169 284 33020 2001 10 "Preset 1";
#X setrgb 31 31 31 220 220 255;
#P objectname text;
#P user multiSlider 140 104 12 82 -1. 1. 1 2681 15 0 0 2 0 0 0;
#M frgb 0 0 0;
#M brgb 255 255 255;
#M rgb2 127 127 127;
#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 objectname slider[5];
#P user multiSlider 120 104 12 82 -1. 1. 1 2681 15 0 0 2 0 0 0;
#M frgb 0 0 0;
#M brgb 255 255 255;
#M rgb2 127 127 127;
#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 objectname slider[4];
#P user multiSlider 100 104 12 82 -1. 1. 1 2681 15 0 0 2 0 0 0;
#M frgb 0 0 0;
#M brgb 255 255 255;
#M rgb2 127 127 127;
#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 objectname slider[3];
#P user multiSlider 80 104 12 82 -1. 1. 1 2681 15 0 0 2 0 0 0;
#M frgb 0 0 0;
#M brgb 255 255 255;
#M rgb2 127 127 127;
#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 objectname slider[2];
#P user multiSlider 60 104 12 82 -1. 1. 1 2681 15 0 0 2 0 0 0;
#M frgb 0 0 0;
#M brgb 255 255 255;
#M rgb2 127 127 127;
#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 objectname slider[1];
#P window setfont Arial 9.;
#P newex 342 419 162 131137545 pattrstorage Interface @savemode 0;
#X client_rect 0 0 640 240;
#X storage_rect 0 0 640 240;
#P objectname Interface;
#P window setfont Arial 10.;
#P user ubumenu 81 268 105 131137546 0 1 1 0;
#X setrgb 31 31 31 255 255 255 234 234 234 4 4 4 141 141 141 112 112 112;
#X add Preset1;
#X add Preset2;
#X add Preset3;
#X add Preset4;
#X add Preset5;
#X add Preset6;
#X add Preset7;
#X add Preset8;
#X add Preset9;
#X add Preset10;
#X add Preset11;
#X add Preset12;
#X add Preset13;
#X add Preset14;
#X add Preset15;
#X add sixteen;
#X add Preset17;
#X add Preset18;
#X add Preset19;
#X add Preset20;
#X add Preset21;
#X add Preset22;
#X add Preset23;
#X add Preset24;
#X add Preset25;
#X add Preset26;
#X add Preset27;
#X add Preset28;
#X add Preset29;
#X add Preset30;
#X add Preset31;
#X add Preset32;
#X prefix_set 0 0 0;
#P window setfont Arial 9.;
#N vpatcher 40 55 355 388;
#P window setfont Arial 9.;
#P window linecount 1;
#P newex 55 223 24 131137545 t 32;
#P newex 57 200 30 131137545 sel 1;
#P newex 58 179 27 131137545 > 32;
#P newex 92 223 19 131137545 t 1;
#P newex 94 200 30 131137545 sel 1;
#P newex 95 179 27 131137545 < 1;
#P newex 165 167 19 131137545 t b;
#P newex 165 188 81 131137545 s ctlpsetchanged;
#P outlet 146 246 15 0;
#N comlet dec;
#P inlet 146 48 15 0;
#N comlet inc;
#P inlet 185 47 15 0;
#N comlet value;
#P inlet 107 49 15 0;
#P window linecount 0;
#P newex 146 117 34 131137545 t b -1;
#P newex 185 117 29 131137545 t b 1;
#P newex 146 146 40 131137545 accum;
#P window setfont "Sans Serif" 9.;
#P comment 54 255 70 196617 clipping to keep the accum in the proper range;
#P connect 14 0 15 0;
#P connect 13 0 14 0;
#P fasten 1 0 13 0 151 170 63 170;
#P connect 11 0 12 0;
#P connect 10 0 11 0;
#P fasten 1 0 10 0 151 170 100 170;
#P connect 6 0 3 0;
#P fasten 4 0 1 0 112 141 151 141;
#P fasten 12 0 1 0 90 246 51 252 34 252 34 126 85 113;
#P fasten 15 0 1 0 52 246 42 246 42 137 93 124;
#P connect 3 0 1 0;
#P fasten 2 0 1 0 190 139 151 139;
#P connect 1 0 7 0;
#P fasten 3 1 1 1 175 139 166 139;
#P fasten 2 1 1 1 209 139 166 139;
#P fasten 1 0 9 0 151 164 170 164;
#P connect 9 0 8 0;
#P connect 5 0 2 0;
#P pop;
#P newobj 238 294 44 131137545 p incdec;
#P window setfont "Sans Serif" 10.;
#P comment 416 56 297 196618 a decent way of creating an interface for pattrstorage.;
#P window setfont "Sans Serif" 9.;
#P comment 62 193 100 196617 your interface;
#P user panel 47 96 125 120;
#X brgb 191 191 191;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P connect 22 1 6 0;
#P connect 23 1 7 0;
#P connect 5 0 19 0;
#P fasten 19 1 11 0 145 258 86 258;
#P connect 19 0 4 0;
#P connect 11 0 21 0;
#P connect 21 1 17 0;
#P connect 24 1 8 0;
#P connect 11 1 21 1;
#P connect 25 1 9 0;
#P connect 16 0 21 2;
#P connect 26 1 10 0;
#P connect 21 0 19 1;
#P fasten 3 0 21 3 202 316 146 322;
#P fasten 4 0 34 0 86 305 158 305;
#P fasten 4 1 34 1 133 305 222 305;
#P fasten 35 0 3 0 355 506 313 506 313 421 335 283 243 283;
#P fasten 34 1 3 0 222 349 233 349 233 292 243 277;
#P fasten 28 0 3 1 63 288 260 288;
#P fasten 27 0 3 2 193 285 277 285;
#P connect 3 0 12 0;
#P fasten 3 0 20 0 243 317 347 317;
#P fasten 15 0 5 0 355 482 327 482 327 405;
#P connect 20 0 5 0;
#P fasten 14 0 5 0 474 418 347 418;
#P fasten 13 0 5 0 434 418 347 418;
#P connect 5 0 18 0;
#P connect 18 0 15 0;
#P connect 15 0 35 0;
#P fasten 21 0 20 1 86 371 405 371;
#P fasten 19 1 20 1 145 256 405 256;
#P fasten 34 0 20 1 158 366 405 366;
#P hidden connect 40 0 41 0;
#P hidden connect 41 0 39 0;
#P window clipboard copycount 44;

March 1, 2008 | 6:02 pm

March 1, 2008 | 9:13 pm

Nice.

I never knew about the text box over ubu trick. Bitchin’

b

March 1, 2008 | 9:19 pm

AND using bucket as a one number storage. Those two things probably
improved my patching more than anything else in months.

Double nice.

b

March 1, 2008 | 9:21 pm

I get desel: No such object

And couldn’t find it in the maxobjects database either.

March 3, 2008 | 10:33 pm

desel – whoops! save as desel.pat and put in your max search path:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 226 83 14 196617 0;
#P message 155 82 14 196617 1;
#P newex 155 59 53 196617 r fxready;
#P newex 225 59 50 196617 r opening;
#P newex 91 83 45 196617 gate 1 1;
#P newex 43 218 49 196617 deferlow;
#P message 110 177 123 196617 script send dummy select;
#P newex 91 126 68 196617 speedlim 500;
#P newex 92 104 60 196617 mousefilter;
#P outlet 90 246 15 0;
#P inlet 94 58 15 0;
#P message 235 177 240 196617 script new dummy number -100 -100 35 9 0 0 0 3;
#P message 8 177 100 196617 script delete dummy;
#P connect 5 0 0 0;
#P connect 5 0 6 0;
#P connect 5 0 1 0;
#P connect 9 0 12 0;
#P connect 10 0 11 0;
#P connect 2 0 8 1;
#P connect 8 0 4 0;
#P connect 4 0 5 0;
#P connect 11 0 8 0;
#P connect 12 0 8 0;
#P connect 1 0 3 0;
#P connect 7 0 3 0;
#P connect 6 0 3 0;
#P connect 0 0 7 0;
#P window clipboard copycount 13;

May 28, 2008 | 6:33 pm

Here is a neater version of the pattrstorage interface, based around javascript. It does all the things the previous post does, but is much tidier. Included in the zip is the js and the .help file for the js.

May 29, 2008 | 2:43 pm

Hi Peter,

That’s a nice interface.

I expect that most users of Max/MSP would need a simple and intuitive, yet flexible, preset management, so I have no idea why this kind of thing is not part of the default Max/MSP app. After all, we have nice interfaces for biquad~, line~ and matrix~.

Thanks for the patch – very useful!

Jonathan

May 29, 2008 | 3:10 pm

Actually you may link a preset object to a pattrstorage. Give a name
to pattrstorage, and enter that name into the "pattrstorage" attribute
in preset’s inspector (or use the "pattrstorage" message). For
concrete examples, see for instance the X.FM~ example patch, or each
of the Cyclist Music series within the examples/sequencing/-looping
folder.

_M

On 29 mai 08, at 16:43, jonathan wrote:

>
> Hi Peter,
>
> That’s a nice interface.
>
> I expect that most users of Max/MSP would need a simple and
> intuitive, yet flexible, preset management, so I have no idea why
> this kind of thing is not part of the default Max/MSP app. After
> all, we have nice interfaces for biquad~, line~ and matrix~.
>
> Thanks for the patch – very useful!
>
> Jonathan

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

Forums > MaxMSP