storing the data in a coll object in a Live Set

    Jan 13 2010 | 4:03 pm
    I have been tinkering with M4L and as a learning exercise I have been building a drum pattern sequencer for use with my monome 128. I have set up the top row of buttons to switch between patterns, which I store in a coll object and load into a matrixctrl, this all works quite well.
    Can anyone offer any advice on the best way (or any way) to have the data in the coll object save with the live set, so I can close the song and then reopen it and have all my patterns intact.

    • Jan 13 2010 | 6:05 pm
      open the inspector of the coll object and tick "save data with object". simple really.
      now writing external xml / large text data on the fly and having that save in set / device is different matter. especially if you wanna freeze the device. you have to look at how pattrstorage can communicate with the live states saving to do that... and it is a bit of a pain...
      hope that helps.
    • Jan 13 2010 | 6:43 pm
      Heh, so simple, I will give it a spin.
      Thankfully I don't think I will be needing to write to an external file right now.
      Thanks for your help.
    • Jan 13 2010 | 7:15 pm
      It seems that this is not so simple after all, "Save Data With Patcher" (not "Object" as above - I assume this was a little mistake on your part, or did I miss something?) does what it says on the tin. If I open the Max Editor and change some values and close the editor again, those values will be saved and every new instance of the device in Live will get those values.
      However, the values entered via the interface exposed in Live are not saved in the patcher (indeed, that is not what I would want anyway as that would over write values from other instances I had used elsewhere).
      Any ideas?
    • Jan 13 2010 | 7:55 pm
      I suggest you write [coll] datas on your HD ( save datas from coll )
      then load it with the device
    • Jan 13 2010 | 8:25 pm
      ok, sorry, olivier is right. writing and storing text files to disk from coll is no probs of course, and easy to have 'factory' and 'user' files recallable with some jiggery pokery. however, if you are making a device to 'freeze' for someone else (?) this can cause problems if you are dynamically re-writing values etc.
      personally i would employ pattrstorage here. how to employ in your case really depends on your setup. is your coll just taking values from interface objects? if so you could do away with it with an appropriately set up pattrstorage. but if it is more complex than that i am not sure what to suggest. maybe a look at the patch...
    • Jan 13 2010 | 8:26 pm
      Hi Olivier,
      it is an idea and I may well have to go with it, but it is not very elegant and means I have to remember to save my [coll] data before closing my Live Set. And then do I have save dialogue or use the live api as the basis for the file name, it seems like a lot of effort for a less than ideal solution.
      I really appreciate you taking the time to answer, but there must be other options?
      I am thinking I can use a [pattr] object with a [matrixctrl], and set parameter mode on the [pattr] to have the values saved in Live. This could replace my [coll] object. The [matrixctrl] would need to have a lot of rows (my [coll] has 256) but I think it could work. I could hide it away in a subpatcher so it wasn't messing up my main patch. Again, it seems a really clunky way to have to do.
      Can anyone see any pitfalls to doing it this way?
    • Jan 13 2010 | 9:09 pm
      Hi pid,
      basically I am using the [coll] to store snapshots of a [matrixctrl], the patch follows.
    • Jan 13 2010 | 9:20 pm
      You don't need coll for this.
      Just use pattr with matrixctrl and save your pattrstorage state with the device. You can manage presets while it is in Live without having to use external files in this way.
    • Jan 14 2010 | 12:14 am
      Thanks for all your help, I am working up a new version that uses [matrixctrl] to store all the patterns. Or at least I was before Max went poof and vanished again. Sigh.
    • Jan 14 2010 | 11:15 am
      Hi guys,
      I have now replaced my coll for matrixctrl objects and bound a pattr object and enabled Parameter Mode. So now when I click save on the Max for Live device, this saves a preset in Live (which actually copies and renames the .amxd file in to the imported folder...).
      This is not really the behavior I was looking for, I want to hit save in the Live set and have the state of the matrixctrl stored automatically with the set (or in a seperate file, but in such a way that it can automatically be loaded back into the device when the live set is opened).
      Can this be done do you think?
      Is there a bang sent out when a live set is closed that the device could respond to?
    • Jan 14 2010 | 12:54 pm
      "This is not really the behavior I was looking for, I want to hit save in the Live set and have the state of the matrixctrl stored automatically with the set (or in a seperate file, but in such a way that it can automatically be loaded back into the device when the live set is opened)."
      --- this is what andrew was talking about. it works, you do not need to save a live device preset.
      "Is there a bang sent out when a live set is closed that the device could respond to?"
      --- you want the "closebang" object to do stuff like this, but, you do not need it in this instance.
      --- you just need some patcher logic to deal with pattrstorage states. regardless of my previous lame points in this thread, i do actually use it like this myself, except with multisliders etc. not used matrixctrl for ages, sorry, but should be exactly the same, as andrew said.
    • Jan 14 2010 | 4:51 pm
      Try this in a device. Note the settings in the pattrstorage inspector
    • Jan 15 2010 | 5:42 pm
      Hi Guys,
      Thanks for your tips, I really appreciate how helpful you have been to me!
      Andrew, your examples still does not work in the way I would like.
      Should I expect edits to the matrixctrl to be stored? If I recall preset 3, edit it, recall 2, then recall 3 the matrixctrl reverts back to its initial value for preset 3...
    • Jan 16 2010 | 9:22 pm
      the order which works is
      recall preset 3
      edit it
      re-save it as preset 3
      In other words, you have to put a step in to save changes.
    • Jan 18 2010 | 10:17 am
      I managed to figure out what I needed to do to get my patch working in the way I want (or at least this section of it...).
      It was actually quite simple in the end. I just bound a pattr to the matrixctrl as I think was suggested ^^^ up there somewhere. I had two problems though, first I had named my pattr ---patterns, based on something I had read about --- (three hyphens) scoping objects to a device level in M4L so you can run multiple instances without conflict. I noticed the folloing problem when trying to use a pattrstorage, the --- get replaced with an ID at run time so my pattr name became something like 109patterns, the problem was every time I opened the Live set the ID incremented. I had saved out the pattrstorage to a json file and it had referenced the previously prepended ID so the data was not loaded. I guessed pattr did something similar so removed the ---.
      My second problem was I was trying to read values before they had been loaded from the pattr, I can't see that there is any bang sent when data is loaded from the pattr so I have just hacked it by delaying the loadbang for a second when the device is loaded. Ugly, but functional.
      I would appreciate it if you cold point me at some docs for the scoping of objects in M4L (the --- stuff).
      Cheers for your help and for putting up with my noob fumblings.
    • May 28 2015 | 1:00 pm
      is there a way to save coll data in a Live set, with a Max for Live device?
      I'd like to use [coll] as it better suits the data I'm using and is working in Max editor.