Swapping Pattrstorage Data

Jan 28, 2013 at 1:52am

Swapping Pattrstorage Data

Hey. I will briefly explain my patch before asking my question. I’m working on a patch that allows me to have finer control of one of my Vsts. Right now I have three independent parameters in which I can increment and decrement. I can switch though toggling each one individually, never loosing my place. As of now, the way I am doing this recalling of data is not through the Pattrstorage object (found inside p_glad), but rather, with a sprintf object. I also have a Pattrstorage object to store their values any time a parameter is adjusted. It is with this Pattrstorage that I have been trying to make a bang or button that allows me to swap between what I have in Osc1Wave and Osc2Wave. I have tried a few objects, but so far, I have been unsuccessful.

What would be the best object to enable me to do this swapping? And would it be better to set up to communicate with Pattrstorage, or just through the two Pattr objects, Pattr Osc1Wave and Pattr Osc2Wave?

– Pasted Max Patch, click to expand. –
Feb 1, 2013 at 2:27am

Any ideas for this one?

Feb 1, 2013 at 4:31am

A little tricky, but i think i got it!

– Pasted Max Patch, click to expand. –
Feb 4, 2013 at 8:44am

Thanks Lume, your patch worked perfectly!

So let me see if I can figure this out…

The bang on the left (outputting to the two getOsc’s) is triggered first. It then gets the value from the pattr objects above. Is this done by taking the getOsc message into the pattr hub? Is that where it gets the value? Then zl slicer removes the name so that the swapie’s name can be put in its place. This new string is sent to a message where the second bang triggers it back into the pattrhub, and the values swap.

pure awesomeness.

So I’m going to be planning on doing this same kind of thing with 2 more oscillators and then about 6 parameters. For these groups i’d eventually like to be able to do this swapping and also implement a cycling function (each parameter’s value is bumped to the next one).

Are there any objects / similar patches and tutorials to my patch / javascript implementations you could suggest for me to check out?

Feb 5, 2013 at 4:51am

That’s how it works yeah. =]

It does sound like an undertaking to me, if you wanna do what you wanna do with standard Max objects.
I’d take this as an oppurtunity to learn about Javascript arrays.


Feb 5, 2013 at 11:27pm

Cool, I shall look into this

Feb 6, 2013 at 1:15am

Another thing!
You should also have a look at the zl objects. They do lots of really neat
processes on lists like rotation. Very useful.

You instantiate them with [zl.mode], where mode is the type of zl object you want to use.


You must be logged in to reply to this topic.