Deleting the envelopes of a custom M4L device containing live.dials
So I have a custom Max midi device in a device chain with 6 live.dials that control and observe mapped parameters of the next VST device in the chain using live.object and live.observer.
When I record automation, envelopes from my custom M4L controlling device and the VST's device are both recorded.
This can cause what I think is a midi feedback loop because there are now two envelopes on different devices trying to control the same parameter.
I want to create a function that automatically deletes every envelope of my custom M4L midi device and leaves the VST device's envelopes intact.
This means that deleting every envelope for the entire clip with clear_all_envelopes is out the question so I'm trying to target each envelope with clear_envelope and each device_parameter [id] of each live.dial.
However, while using a live.path fed by "path this_device canonical_parent canonical_parent chains 0 devices 0 parameters $1" and passing in the order of the parameter works to target and delete the envelopes on the VST device, it does not work to delete the envelopes on my custom device where I actually want to delete each the duplicate envelope(s).
For some reason, the id number live.path gives me on my custom device, will delete a seemingly random envelope instead of the one I fed in as the device's live.dial parameter order.
I'm assuming because these are live.dials instead of full fledged Ableton Live UI elements, the live dial's id does not correspond to its respective envelope.
One hypothesis I have is that the envelopes are created and assigned IDs as their respective dials are being turned instead being assigned IDs that are the same as their related live.dial ID. I think this might be the case because the IDs that can be used to actually delete the envelopes on this device seem to be in no visible sequential order.
My questions are:
1) Is there a way to target and delete envelopes by the envelope's name? If so, what would that syntax be?
2) Is there a way to target and delete envelopes by the live.dial's names such as "scripting name", "long name" or "short name"? If so, what would that syntax be?
3) Is there a way from the custom Max for Live device to quickly delete an entire device's envelopes, but not the envelopes of other devices?
4) Any additional tips or helpful ideas would be appreciated!
Thank you kindly!
I think it should basically work with the following steps.
Assign your device id to a live.object and send it the message 'get parameters'.
This will output the list of ids of all automatable device parameters.
Assign your clip id to a live.object and send it the message 'call clear_envelope id $1'
with $1 for all id numbers from the previous list.
I think this is putting me on the right track. So thanks again.
When I print from the live.object of the device I get "parameters id 97 id 89 id 88 id 87 id 86 id 85 id 84". What is the best way to remove the word "parameters", remove the words"id" and feed the id's into the "call clear_envelope id $1" message one by one?
For now I placed a "zl iter 1" between the device's live.object that outputs its parameters and the"call clear_envelope id $1" message running into the clip's live.object. It gives me an error "invalid arguments: 'clear_envelope id parameters'" for the first word and, "invalid arguments: 'clear_envelope id id'" for each param, but works at every iteration of an integer! Happy it got this far, but I know there's a better way to do this part.
For example this way.
Or this.
I would route the message through [route parameters] object to get rid of 'parameters, and then route the 'id # id #....) messaage through a zl.delace object so only the number go out the right outlet of the zl.delace object. I THINK. can't check right now.
there's a few ways you could do it. The zl objects will help. you could also iterate the id # id # message through a [zl.iter 2] object or a [zl.group 2] object so a singular 'id #' message is output and then you could use [filter id] or [zl.filter id].... try the first method I mentioned.
I figured out that putting a "route parameters" right outputting to a "route id" after the "zl iter 1" works to strip the unwanted text. I'm going to check out both of your solutions now. Thanks so much! Incredibly helpful.