Old 06-16-2021, 01:31 PM   #1
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default How to delete a track envelope?

Can anyone help me out with this? I'm looking for a way to delete all envelopes from a track by script. I see there is an SWS action 'Envelope: Clear or remove envelope' however..., running that pops up a message box asking if you want to delete the envelope...., which seems very odd to me. Because, well..., that's the reason for running the action.

My end goal is simply to duplicate the selected track where the duplicated track has all the envelopes from the original track removed/cleared/deleted. There are other things I want to do with the duplicated track that I can figure out..., but getting rid of the envelopes is a mystery to me. I'm also not seeing anything in the API for something like 'remove selected envelope' or anything along those lines.

Maybe this has to do with 'chunks'?
benmrx is offline   Reply With Quote
Old 06-16-2021, 01:42 PM   #2
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

I use "SWS/S&M: Remove all envelopes for selected tracks" and was told to stop it from showing the confirmation dialog I had to edit my S&M.ini...
Code:
[Misc]
RemoveAllEnvsSelTracksPrompt=0
Edgemeal is offline   Reply With Quote
Old 06-16-2021, 02:10 PM   #3
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Quote:
Originally Posted by Edgemeal View Post
I use "SWS/S&M: Remove all envelopes for selected tracks" and was told to stop it from showing the confirmation dialog I had to edit my S&M.ini...
Code:
[Misc]
RemoveAllEnvsSelTracksPrompt=0
Thank you!!
benmrx is offline   Reply With Quote
Old 06-16-2021, 02:32 PM   #4
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Hmmm. Actually..., this still isn't quite what I was hoping for. You can see in the licecap, that when I duplicate the track with the script, and then check the duplicated tracks send envelope, the send envelope is automatically set at 0/unity. It should be at -infinity (I would think). I know somewhere, in some preference I have it set so Reaper will have sends default to -infinity.



I'm wondering if a better way to achieve what I want (a duplicated track, with the same routing, same name, same color, same FX, same sends, but NO automation or envelopes and no items is to simply 'create a new track', and copy the name, color, routing, etc. from the selected track.
benmrx is offline   Reply With Quote
Old 06-16-2021, 02:41 PM   #5
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

It's still possible, by working with statechunks. You can eliminate the envelopes from there, keeping the rest.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 06-16-2021, 02:56 PM   #6
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
It's still possible, by working with statechunks. You can eliminate the envelopes from there, keeping the rest.
Thanks, that's sort of what I was afraid of. 'Chunks'...., I need to do a ton of homework on. I have no idea what they are..., except that (I think) they are basically long strings that contain various bits of info/data. Which if that's the case, I still need to better understand how to parse strings in LUA using 'patterns', which I've done a bit of..., but not much.
benmrx is offline   Reply With Quote
Old 06-16-2021, 03:38 PM   #7
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Quote:
Originally Posted by benmrx View Post
You can see in the licecap, that when I duplicate the track with the script, and then check the duplicated tracks send envelope, the send envelope is automatically set at 0/unity. It should be at -infinity (I would think). I know somewhere, in some preference I have it set so Reaper will have sends default to -infinity.
I think the 'issue' here is that the send is already existing (as you duplicated a track with a send) and so the envelope is created at the level that send currently is.
I currently can't think of a straightforward way to 'fix' it though (so that it'd work as you intend).
nofish is offline   Reply With Quote
Old 06-16-2021, 03:54 PM   #8
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Quote:
Originally Posted by nofish View Post
I think the 'issue' here is that the send is already existing (as you duplicated a track with a send) and so the envelope is created at the level that send currently is.
I currently can't think of a straightforward way to 'fix' it though (so that it'd work as you intend).
I see what you're saying. And I'm probably misunderstanding what it means to 'remove all envelopes for selected tracks'. And/or I misunderstand this project preference.



Thank you, everyone! Always learning something new.

Last edited by benmrx; 06-16-2021 at 04:51 PM.
benmrx is offline   Reply With Quote
Old 06-16-2021, 05:02 PM   #9
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Yes, what you marked in red applies to new sends, I use the same setting.
When you remove the send envelope you don't remove the send itself though and hence the send envelope for the send on the duplicated track comes up at the value the send is at. Hard to describe for me in words, maybe more clear when also looking at the mixer? (doing essentially what your script does)



What you could probably do is iterate over the sends on the duplicated tracks and set them to -inf, something like this:

Code:
-- set sends on selected tracks to -inf
for i = 0, reaper.CountSelectedTracks(0)-1  do
  local tr =  reaper.GetSelectedTrack(0, i)
  local numSends = reaper.GetTrackNumSends(tr, 0)
  for j = 0, numSends-1 do
    reaper.SetTrackSendInfo_Value(tr, 0, j, "D_VOL", 0)
  end -- loop through sends 
end -- loop through selected tracks

Last edited by nofish; 06-16-2021 at 05:17 PM.
nofish is offline   Reply With Quote
Old 06-17-2021, 11:53 AM   #10
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Quote:
Originally Posted by nofish View Post

What you could probably do is iterate over the sends on the duplicated tracks and set them to -inf, something like this:

Code:
-- set sends on selected tracks to -inf
for i = 0, reaper.CountSelectedTracks(0)-1  do
  local tr =  reaper.GetSelectedTrack(0, i)
  local numSends = reaper.GetTrackNumSends(tr, 0)
  for j = 0, numSends-1 do
    reaper.SetTrackSendInfo_Value(tr, 0, j, "D_VOL", 0)
  end -- loop through sends 
end -- loop through selected tracks
Thanks!!

I missed that function in the API as I was only searching for 'envelope'.
benmrx is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 11:26 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.