preset, pattrstorage and many instances

Learn about building and using Max for Live devices.
Post Reply
cip23
Posts: 32
Joined: Wed Mar 31, 2010 9:46 pm

preset, pattrstorage and many instances

Post by cip23 » Tue Jun 26, 2012 5:52 pm

In my patch (a midi effect) I have a pattrstorage and a preset object.
In a typical situation, there are several instances of the patch in a Live set. The preset object stores values which are auto-stored as soon as I change the midi clip playing in the track, and the values for the current clip are retrieved from the preset and applied.

So there's a coupling (at least that's my intention) between the track and the clips in the track on the one hand and the M4L patch in the track. Couple of questions here, since I'm new to M4L.

How is the pattrstorage supposed to work? Does it store values *instancewise* within the Live set? So there's no need to ever store the contents of the preset to disk? Or would I need to store the preset as json? And if that is the case, is there a solid way to do this automatically for every instance (like with the live object id of this_device in the name)? Frankly, I'm suffering of cognitive overload with all the different objects, their settings and the behavior of Max/Live in their several modes... :(

Thanks for any clarification!

best regards,
Christoph

chapelier fou
Posts: 6012
Joined: Mon May 15, 2006 12:15 pm

Re: preset, pattrstorage and many instances

Post by chapelier fou » Tue Jun 26, 2012 6:07 pm

I am having issues too. Progressing but i have no time, for now...
You can find helpful infos in the topic i opened, i reckon. Good luck !
viewtopic.php?f=35&t=181228
MacBook Pro 13" Retina i7 2.8 GHz OS 10.13, L10.0.1, M4L.
MacStudio M1Max 32Go OS 12.3.1

cip23
Posts: 32
Joined: Wed Mar 31, 2010 9:46 pm

Re: preset, pattrstorage and many instances

Post by cip23 » Tue Jun 26, 2012 6:17 pm

chapelier fou wrote:I am having issues too. Progressing but i have no time, for now...
You can find helpful infos in the topic i opened, i reckon. Good luck !
viewtopic.php?f=35&t=181228
Thanks for the quick reply! I'll check that thread, and perhaps we can keep the discussion there. (It's even a very similar project.) :-)
BTW, I like your music!

best regards,
Christoph

cip23
Posts: 32
Joined: Wed Mar 31, 2010 9:46 pm

Re: preset, pattrstorage and many instances

Post by cip23 » Mon Jul 02, 2012 5:44 pm

I need to bring this up once more.

Here's my patch:

Code: Select all

<pre><code>
----------begin_max5_patcher----------
742.3ocoUkraaCCD8r7Ww.c1MPT6tW5xsdoH.8XPfgVFay.IRWR53jFj+8xk
PapD4hz1C1TZ3vYdy6MC0SKhha4OfxX3ivMPTzSKhhrlLFhd48n3wlG5FZjV
2h63iiHSEuzsmBePYs+c9wkvN9QnmCeCT3v.n1gv9FkRHUbQyVD3s2gcJPwA
Yy8HPURniyT5vIgiT0NnA5oa1fBsEf0LhvFt.v6Qwi.kIUMrNcP13Cb2NsUX
7QXfpilDUexipAJC63GXVnU7hQ1gQJa.U15fb1H+fxaM4EqaznRR+EZ8L8Ju
YZusT0kwGHwAtZfpcmuHnMC9crHjx1tVnKZGEmuZkNXPZVsYgTTZVpJtJAt0
blmWrv72x2oTvviZn3S28MhS3Xuf2JU392nRSjCuWvmMxwHuGgr32OYQlirR
lirJJ7g0cb0i6QGgDGC2dQhD9Jen+OxlYF9KKMwxl04tECa9xgZNnKUzTuS4
kqtSxY9HaJ990tdy0F9g1dP4FJhNw7F.HznSgh0Hqoc.C5Whh6Fn5d1PrsDx
0+xJp0PpJ0iHc1bjefqE0YKgxUZ+RxzGgrp5r21jRYTkQcrYztgsQ4uscYul
IP0bsKi+Pg+Tb8j8msAvFBlpQQ0z2EaLxeaGPd8E6.7vBhoL6xTCmzxvbGxd
oU1QJh4+RWKPZVPO.N1h8gC2y0IUaONIovr3FKIl.eN6ACNSGw9GThwCCJpb
f1ih4jC2N5PbsNGMszAphp6G++ElzYtGa0kGMWFNddZBuza.UZfnqKm6tYvj
jPNadEK2JXD2MgtERZ3Ta61N9.W3ia0pTRQ0RySkIU04gOQBN11cbopsQDV+
R5VlS8IWV8KxyCT+rDxagjSRl.qhx7pjRCXzvqrdxSjWcitMN1uJ8pu0ZQiw
9ztEI+fnyqC94G3Lb502oQYmT6aNqkANsi12irvN+QZ+dtdnR5u+TWEZMH2p
c4k1xe5atuWUTjYbz7xqJqEOu32.zheBHB
-----------end_max5_patcher-----------
</code></pre>
It contains a multislider, a preset and a pattrstorage object. I want to keep states of the multislider as presets and store the presets via pattrstorage. The pattrstorage attribute of the preset is set to the name of the pattrstorage object.

Everything works fine until I use this patch several times in a live set. The live set stores (obviously and logically) only one preset file, so that on reopening my set, all presets have the same content. Not what I want.

Now, do I need to set the name of the pattrstorage *and* the pattrstorage attribute of the preset to some kind of unique name? Or could I let the pattrstorage take care of its own name (u2340402234098 or so) and tell the preset to use the pattrstorage without passing the name? Any ideas are welcome.

best regards,
Christoph

JuanSOLO
Posts: 3236
Joined: Sun Jul 15, 2007 8:21 am
Location: Shreveport LA, sometimes Dallas/Ft Worth TX

Re: preset, pattrstorage and many instances

Post by JuanSOLO » Tue Jul 03, 2012 2:31 pm

cip23 wrote:Now, do I need to set the name of the pattrstorage *and* the pattrstorage attribute of the preset to some kind of unique name? Or could I let the pattrstorage take care of its own name (u2340402234098 or so) and tell the preset to use the pattrstorage without passing the name? Any ideas are welcome.
It's better practice to name everything that has a relationship with pattrstorage in your patch.
The Max help file on pattrstorage is a crucial read if you plan on making patches with preset devices.
It WILL answer 80% of the questions you develop about pattrstorage.

cip23
Posts: 32
Joined: Wed Mar 31, 2010 9:46 pm

Re: preset, pattrstorage and many instances

Post by cip23 » Tue Jul 03, 2012 2:43 pm

JuanSOLO wrote: It's better practice to name everything that has a relationship with pattrstorage in your patch.
The Max help file on pattrstorage is a crucial read if you plan on making patches with preset devices.
It WILL answer 80% of the questions you develop about pattrstorage.
Thanks for your answer.
I did read the help file, several times, and I read the tutorial. I really did!! :-)
And what I learned is that a [preset] is supposed to have a 'pattrstorage' attribute with the name of the [pattrstorage] object.
My problem is that this name needs to be unique *across several patches* so that *each* patch can autostore its contents (because this is how it determines the name of the file it reads from and writes to).

The problem meanwhile melts down to this question: which message do I have to send a [pattrstorage] so that it sends its varname attribute (aka Scripting Name)?

JuanSOLO
Posts: 3236
Joined: Sun Jul 15, 2007 8:21 am
Location: Shreveport LA, sometimes Dallas/Ft Worth TX

Re: preset, pattrstorage and many instances

Post by JuanSOLO » Tue Jul 03, 2012 2:57 pm

cip23 wrote:The problem meanwhile melts down to this question: which message do I have to send a [pattrstorage] so that it sends its varname attribute (aka Scripting Name)?
I am not sure.
Although I am more clear about your problem, I am still unclear about a lot of things. AND I am no pattrstorage expert at all.

when you say "across several patches"
this could mean a lot of things, and I am wondering if there is another way to accomplish your task

Are you trying to have 1 patterstorage that rules many patches?
or 1 preset object that triggers several patterstorage objects?

cip23
Posts: 32
Joined: Wed Mar 31, 2010 9:46 pm

Re: preset, pattrstorage and many instances

Post by cip23 » Tue Jul 03, 2012 3:39 pm

JuanSOLO wrote: when you say "across several patches"
this could mean a lot of things, and I am wondering if there is another way to accomplish your task
Are you trying to have 1 patterstorage that rules many patches?
or 1 preset object that triggers several patterstorage objects?
None of these, sorry for being unclear.

I posted a patch further up in the thread. This patch - or a more complex version of it - works as a MIDI effect in several tracks in a Live set.
So there is a rather simple mapping:
Per track in Live there is one patch containing one preset and one pattrstorage. These patches are supposed to be independent from each other.

What I want to achieve is that they are dependent on the track in Live. So whatever I did in the track will be stored when I close the live set an recalled when I open the live set, one set of values for every track. Just like in any other effect or soft synth.

The problem: out of the box, if I give my pattrstorage a name in my Max patch, all of the patch instances will write to the same file and have the same values. :-(

That's why I want to use the auto-name of the pattrstorage. And it drives my almost crazy that I can't find out how to acquire that name.
:-)

cip23
Posts: 32
Joined: Wed Mar 31, 2010 9:46 pm

Re: preset, pattrstorage and many instances

Post by cip23 » Tue Jul 03, 2012 3:48 pm

ok, it's the message *getname*. It was not in the list of messages that is shown when I click and hold on the left inlet. Forgive the dumb question.

JuanSOLO
Posts: 3236
Joined: Sun Jul 15, 2007 8:21 am
Location: Shreveport LA, sometimes Dallas/Ft Worth TX

Re: preset, pattrstorage and many instances

Post by JuanSOLO » Tue Jul 03, 2012 4:14 pm

there are no dumb questions here man.

cip23
Posts: 32
Joined: Wed Mar 31, 2010 9:46 pm

Re: preset, pattrstorage and many instances

Post by cip23 » Tue Jul 03, 2012 5:15 pm

JuanSOLO wrote:there are no dumb questions here man.
All the better. Thanks for your assistance!

cip23
Posts: 32
Joined: Wed Mar 31, 2010 9:46 pm

Re: preset, pattrstorage and many instances

Post by cip23 » Wed Jul 04, 2012 8:32 am

There was a misunderstanding here. I wanted to store the contents of the preset object, but the preset is just intended as as 'UI' for the pattrstorage.

Now everything works fine. The pattrstorage runs in parameter mode with 'initial enable' checked. No need to save anything to a separate file. Every object whose state I want to store has a pattr object bound to it. I can store and retrieve different values for all patch instances in a live set implicitly.

One small problem remains. For whatever reason, my pattrstorage object changes its 'Scripting Name' attribute whenever it appears in Live. Is this intended behaviour? For that reason, I can't bind a preset object to it (as UI).

Any ideas?

best regards,
Christoph

Post Reply