How to store device "preset like" with LiveAPI ?

Billy's icon

Hello, I'm creating a device to store and recall on the fly some "presets" of a device like Operator. By preset I mean I would like to find a good state of operator, save it on a bank, then change everything on Operator, save it on a second bank, and being able to recall each of them with a simple button.

The best exemple I can give to be clear is Gradient : https://patches.zone/max-for-live/gradient

I find solution for almost every step of my project, but I can't find a way to get the value of each parameters. I can get all their ID, but not their state, so I can't save or bank them.
The gradient device is all javascript coded, I'm too new in coding to find exactly what I want inside it.

Anybody can help ?
thanks :)

schlam's icon

Hello,
Here it's a patch that collects all parameters of a Live device and feed a poly~ with them.
There is an autopattr in the poly~ so you will easily grag all values in a pattrstorage to store/interpolate them.
Usually each parameter will have the name and the min max values of the original parameter.

hope it helps

cheers !

Max Patch
Copy patch and select New From Clipboard in Max.


EDIT : the .maxpat in the poly~ was missing. here it is :

devicesparam.maxpat
text/plain 75.78 KB


schlam's icon

for information, if you want to know the value of a parameter.
send "property value" to live observer with the id of your parameter in the right inlet




Billy's icon

Thank you Schlam, this patch is exactly what I was looking for, a clear way to seperate every id and observe all values at the same time. I learn a lot with this !
I just added autopattr with pattstorage and create some banks, it worked so easy.

I still have some trouble with specific devices because the patch seems to catch also the not quantized parameters and it cause error for exemple with operator, but I will find my way to filter them out !

Thanks again :)
Billy.

schlam's icon

You are welcome.! I learned a lot too when I made that. =)


.i added the "is quantized" stuff for a personal problem in my set.up, because with quantized parameters when you interpolate them with pattrstorage they are restored at the end of the interpolation and not at the middle.
Maybe you can unpatch the "is_quantized" and "value_items" to the live.dials in the poly~ and replace this behaviour with "interp devicesparam.X::live.dial thresh 0.5" in the pattrstorage client window. Maybe it can solve your problem.

You can too bypass some parameters in the pattrstorage with "active .... 0".

Billy's icon

Hi there, just to speak about the problem I've encouter and solved, if someone in the futur will try to make similar stuff.

Your patch Shlam had some problem with me that I wasn't able to identify at first. I was observing many other similar patch to find the best technics, and I was confused because some patch was using the same way with zl. objetcs and then poly~. And this is where I had problem. I was comparing other patch for a single Operator with yours, to see how many parameters your patch can catch and how many with the other. 195 for the others and yours was stuck at 128.

For those who have this problem : The patch is working but not on all parameters of a device, don't panic !
check the maximum lenght of every zl object because my problem was just this, all the zl. object was by default set to maximum lenght 256 (yes, you get it, 2x128...)
Then I changed them to 1000 in inspector, save, try, and... same issue !
I still ignore why it didn't save the change default value, but you can add this directly in the object with @zlmaxsize attribute.
And now everything work perfectly.

Again thank you Schlam, I learned A LOT with this project, now LOM has no secret anymore !

Hope it will help folks on the future.
Cheers.
Billy :)

Francesco Gallo's icon

Do have the full patch with the pattrstorage?

Billy's icon
Premo.amxd
amxd

Hey, my project was this devices (Premo).
It loads and store parameters of any devices in Live, and you can recall different banks of their state with midi notes.

It was more than two years ago so I prefer to just give the full patch than trying to copy/paste just a part that will miss comprehensive elements.

Feel free to ask anything I'll try my best to help.
Billy.

Francesco Gallo's icon

Cool, I already have this patch, it's so useful.

I've not explored inside yet is it possible to interpolate between presets giving a float value?

Billy's icon

You mean like a morphing ? I'm sure it's possible because the device called "Smooth Automator" does this. But the patch is probably not working exactly as mine, I don't know. Once again I recommend to open it ! :)