Forums > Max For Live

unique static device number

Feb 19 2013 | 2:19 pm


Im wondering if theres a way to give a device a unique static number? Ive tried using "—" and it seems to give me a different unique number each time I load the set. I would like the unique number to only be loaded once, when the device is loaded for the first time and then stay persistant throughout its usage, such as moving tracks, saving as a adv preset. Is there any way to do this? perhaps pattr? Ive tried a few things and I cant seem to get the unique number to persist



Feb 20 2013 | 10:59 am

It might help if you describe what you’re actually trying to achieve….

Feb 20 2013 | 12:33 pm

Im trying to get a device to save a local file along with it. This file will follow the device as it gets copied, moved, presetted etc within the set. For instance, if the device is copied (or saved as an adv preset), this is a new device and therefore it will require a new file. However, if the device is moved, it should use the same file.

The only way I could think of is to create a file that is unique to the live_set ie. My_Live_Set-My_Device_File, but m4l dont give us an id or name for the live set in the api. Another way might be to listen to the "preset name", but m4l dont give us access to this as well.

The way Im trying to do it at the moment is to create a random number, when the device is used for the first time and then to never change that number, unless the device is copied or saved as an adv preset, but Im struggling to detect when the device is copied, or saved as a preset.

Here are the actions Im trying to achieve:

New Device: New Number
Copied Device: New Number
Saved as adv Preset: New Number
Moved Device: Same Number
Saved/Recalled along with the live set: Same Number

Heres the code Im using. Its not the best code, because Im trying every solution I can think of, to test if theres a way to do this. Im also a little new to m4l. Many thanks for taking the time out to help.

-- Pasted Max Patch, click to expand. --

Feb 20 2013 | 7:46 pm

Your approach doesn’t make much sense to me.

With pattrstorage you can handle multiple presets by numbering and storing in a single file. Or you can create multiple adv presets without using pattrstorage and thus no files at all.

Feb 20 2013 | 8:27 pm

Im afraid these files are fxp. There are things inside a vst~ object that max cannot reach. For instance in massive synth its possible to connect envelopes to parameters. However, max doesnt see any of these kinds of changes. The only way I can see to record these changes is through fxp files, hence the need for saving a unique fxp file for every instance of this device. Would love to hear if there are any other ways to solving this problem.

Feb 20 2013 | 9:27 pm

you can use the device id (from the Live API: [path this_device]) instead of the — identifier. Is unique and persistent (reloading the set, moving the device and so on…)

Feb 20 2013 | 10:34 pm

Hi Jan, thanks for the idea, Im trying to use the device id as well, but it seems something is happen on the creation of a new device that is limiting me. Ive posted another post here describing the issue, with patches included:



Feb 21 2013 | 5:49 pm

Im really confused now. Ive been working solidly for around 4 days to try and make this work. there must be a simple solution.

I simply would like my device to have two number boxes, saving the boxes in the following way using loadbang, based on how live saves devices/sets

New device – default id (0), new id
adv preset device – recall id, new id
copied device – recall id, new id
saved device in set – recall id

Ive been round and round in circles with pattr and coll. Is there anyone that can suggest a way to achieve this.



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

Forums > Max For Live