Old 01-05-2023, 03:20 PM   #1
Kapitano
Human being with feelings
 
Kapitano's Avatar
 
Join Date: Sep 2010
Location: Elsewhere, England
Posts: 36
Default Select Envelope

This lua script...

Code:
reaper.Main_OnCommand(40726 , 0) -- Envelope: Insert 4 envelope points at time selection
for i = 1 , 48 do reaper.Main_OnCommand(41181 , 0) end -- Envelopes: Move selected points down a little bit
reaper.Main_OnCommand(40635 , 0) -- Remove Time Selection
... lowers the volume of the current time selection in the current take. BUT only if the take volume envelope is visible and selected.

Is there a way to automatically select that particular envelope as the one to apply the script to, without having to manually mouseclick on it?
__________________
"Nothing gets older faster than a new sound." - Milton Babbit
Kapitano is offline   Reply With Quote
Old 01-05-2023, 03:58 PM   #2
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,333
Default

As you are already using scripts, I believe it is better to use something already existing.

1. Install Reapack: https://reapack.com/
2. Go to Actions.
3. Find:
Script: amagalma_Change Take Volume (insert 4 points) for selected items (or selected take vol env) in time selection by set amount (Settings).lua
Script: amagalma_Change Take Volume (insert 4 points) for selected items (or selected take vol env) in time selection by set amount (down).lua
Script: amagalma_Change Take Volume (insert 4 points) for selected items (or selected take vol env) in time selection by set amount (up).lua
4. The first one shows the input box, where you provide values. After that you can use second or third with these values.
vitalker is offline   Reply With Quote
Old 01-05-2023, 04:56 PM   #3
Kapitano
Human being with feelings
 
Kapitano's Avatar
 
Join Date: Sep 2010
Location: Elsewhere, England
Posts: 36
Default

Brilliant, thanks.

Modified to silence audio and remove time selection. Editing out clicks just got a lot easier.
__________________
"Nothing gets older faster than a new sound." - Milton Babbit
Kapitano is offline   Reply With Quote
Old 01-08-2023, 11:27 PM   #4
Kapitano
Human being with feelings
 
Kapitano's Avatar
 
Join Date: Sep 2010
Location: Elsewhere, England
Posts: 36
Default

This might be useful. A lua script to silence any audio in a selected item, in an area defined by loop selection.

Code:
i_MediaItem = reaper.GetSelectedMediaItem(0 , 0)
if i_MediaItem == nil then return end
i_ItemStart = reaper.GetMediaItemInfo_Value(i_MediaItem , "D_POSITION" )
i_ItemEnd = i_ItemStart + reaper.GetMediaItemInfo_Value(i_MediaItem , "D_LENGTH" )
i_ActiveTake = reaper.GetActiveTake(i_MediaItem)
i_LoopStart , i_LoopEnd = reaper.GetSet_LoopTimeRange(0 , 0 , 0 , 0 , 0)
if i_LoopStart == i_LoopEnd then return end
if i_LoopStart <= i_ItemStart then i_LoopStart = i_ItemStart end
if i_LoopEnd >= i_ItemEnd then i_LoopEnd = i_ItemEnd end
if i_LoopEnd <= i_ItemStart then return end
if i_LoopStart >= i_ItemEnd then return end
reaper.Main_OnCommand(40020 , 0) -- Remove Time Selection
reaper.Main_OnCommand(reaper.NamedCommandLookup("_S&M_TAKEENVSHOW1") , 0) -- Show take volume envelope
i_TakeEnvelope = reaper.GetTakeEnvelopeByName(i_ActiveTake , "Volume" )
reaper.InsertEnvelopePoint(i_TakeEnvelope , i_LoopStart - i_ItemStart , 716 , 1 , 0 , 0 , 0)
reaper.InsertEnvelopePoint(i_TakeEnvelope , i_LoopStart - i_ItemStart , 0 , 1 , 0 , 0 , 0)
reaper.InsertEnvelopePoint(i_TakeEnvelope , (i_LoopStart - i_ItemStart) + (i_LoopEnd - i_LoopStart) , 0 , 1 , 0 , 0 , 0)
reaper.InsertEnvelopePoint(i_TakeEnvelope , (i_LoopStart - i_ItemStart) + (i_LoopEnd - i_LoopStart) , 716 , 1 , 0 , 0 , 0)
__________________
"Nothing gets older faster than a new sound." - Milton Babbit
Kapitano 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 02:21 AM.


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