|
|
|
06-09-2021, 02:35 PM
|
#2561
|
Human being with feelings
Join Date: Feb 2007
Location: VA
Posts: 885
|
Request - toggle mute hardware out of selected tracks
This is a very long post, my answer is at the bottom, however problems remain... only muting hw output. See EDIT6
Also - did not get to toggle master parent yet.
I use an x32, want to do virtual sound checks with it and reaper.
No problem.
Then I want to mix in the box, need to
1. toggle mute off for hardware outs of selected tracks then
2. toggle master parent on for selected tracks.
Checked reapack - Nofish has a mute first n hardware outs on tracks that are currently recording, but that is closest.
Not sure where to start.
Thanks.
Here is a start at muting hardware output, but it only does the send
Code:
-- Lua script to toggle mute
-- TRACK SEND 1 on selected tracks
local send_target = 0 -- send 1, as send counts start at 0 in Reaper
-- is this the hardware output if I set it to 1
function toggle_send_mute()
local tr_count = reaper.CountSelectedTracks(0)
if tr_count == 0 then
return
end
reaper.Undo_BeginBlock()
for i=1, tr_count do
local tr = reaper.GetSelectedTrack(0, i-1)
if tr ~= nil then
-- count hardware outs (this is needed to get the correct send index)
local tr_num_hw_outs = reaper.GetTrackNumSends(tr, 1)
reaper.ToggleTrackSendUIMute(tr, tr_num_hw_outs + send_target)
end
end
local undo_string = "Toggle send mute "..tostring(send_target+1)
reaper.Undo_EndBlock(undo_string, -1)
end
reaper.defer(toggle_send_mute)
Found this here https://forum.cockos.com/showthread.php?t=174049
It will mute and unmute send 1, which is very close.
How do I make it toggle mute on a hw output?
EDIT
REAPER API says this below - what do I need to change?
Code:
boolean reaper.ToggleTrackSendUIMute(MediaTrack track, integer send_idx)
send_idx<0 for receives, >=0 for hw ouputs, >=nb_of_hw_ouputs for sends.
Also - is there a way to print value of var so I can view it?
EDIT2
This works, at least for 1 track, how to make it less convoluted and why does it work so I can edit it?
Code:
-- Lua script to toggle mute
-- TRACK SEND 1 on selected tracks
local send_target = -1 -- send 1, as send counts start at 0 in Reaper
-- is this the hardware output if I set it to 1
function toggle_send_mute()
local tr_count = reaper.CountSelectedTracks(0)
if tr_count == 0 then
return
end
reaper.Undo_BeginBlock()
for i=1, tr_count do
local tr = reaper.GetSelectedTrack(0, i-1)
if tr ~= nil then
-- count hardware outs (this is needed to get the correct send index)
local tr_num_hw_outs = reaper.GetTrackNumSends(tr, 1)--1
reaper.ToggleTrackSendUIMute(tr, tr_num_hw_outs + send_target)
end
end
local undo_string = "Toggle send mute "..tostring(send_target+1)
reaper.Undo_EndBlock(undo_string, -1)
end
reaper.defer(toggle_send_mute)
--
All I changed was the send_target var.
EDIT3
If I have 2 hw outs and I set the send_target =-2 it toggles the mute of hw out 2.
With 2 hw outs and send_target = -1 it mutes hw out 1.
What is going on?
EDIT4
Code:
reaper.ToggleTrackSendUIMute(tr, tr_num_hw_outs + send_target)
The value passed for 2 hw outputs and send_target = -1 would be 1 wouldn't it?
Yes it would and I just confirmed, if I set send_target = -3 with 2 hw outs, I get a receive mute. Wow!
I think I got it.
How to do some math?
I would like to make sure that I am always working with hw_outs.
So I need a calculation that makes sure it will be hw output 1
EDIT5
Code:
-- Lua script TOGGLE MUTE HARDWARE output 1 on selected tracks
--[[
The number of hw outs makes all the difference
*send_idx<0 for receives, >=0 for hw ouputs, >=nb_of_hw_ouputs for sends.
If hw outs are 1 and send_target = -1 the result is zero
--]]
local send_target = 0 -- just to set a value for the var, send counts start at 0 in Reaper
function toggle_send_mute()
local tr_count = reaper.CountSelectedTracks(0)
if tr_count == 0 then
return
end
reaper.Undo_BeginBlock()
for i=1, tr_count do
local tr = reaper.GetSelectedTrack(0, i-1)
if tr ~= nil then
-- count hardware outs (this is needed to get the correct send index)
local tr_num_hw_outs = reaper.GetTrackNumSends(tr, 1)
-- set send_target equal to numbers of hw outs
local send_target = tr_num_hw_outs
-- subtract the above vars to always get 0, which is the first hw output
reaper.ToggleTrackSendUIMute(tr, tr_num_hw_outs - send_target)-- if >=0,then hw_out
end
end
local undo_string = "Toggle send mute "..tostring(send_target+1)
reaper.Undo_EndBlock(undo_string, -1)
end
reaper.defer(toggle_send_mute)
Now to look at toggling master parent send on when hw_out 1 is muted.
Perhaps tomorrow.
EDIT6
Script does not differentiate - if no hw input, it will mute first send.
If track A has a hw out and B does not, it will mute the first send on B.
Not ideal, at all...
I might need some advanced logic to solve that.
Last edited by flipotto; 06-09-2021 at 08:28 PM.
Reason: problem solving
|
|
|
06-10-2021, 08:08 AM
|
#2562
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
|
Do you want to toggle all hardware outs for selected tracks or only the first one?
This should (hopefully) work for all:
Code:
-- Toggle mute hardware outputs for selected tracks
function main()
for i = 0, reaper.CountSelectedTracks(0)-1 do
local tr = reaper.GetSelectedTrack(0, i)
local numHWouts = reaper.GetTrackNumSends(tr, 1)
for j = 0, numHWouts-1 do
-- exclusive OR current state with 1 -> toggle
reaper.SetTrackSendInfo_Value(tr, 1, j, "B_MUTE", reaper.GetTrackSendInfo_Value(tr, 1, j, "B_MUTE")~1)
end -- loop through HW outs
end -- loop through selected tracks
end -- main()
main()
-- https://forum.cockos.com/showpost.php?p=2090533&postcount=27
reaper.Undo_OnStateChangeEx("Toggle mute hardware outputs for selected tracks", 1, -1)
For toggling master/parent send you can use
SetMediaTrackInfo_Value with B_MAINSEND.
Last edited by nofish; 06-10-2021 at 08:23 AM.
|
|
|
06-10-2021, 12:00 PM
|
#2563
|
Human being with feelings
Join Date: Feb 2007
Location: VA
Posts: 885
|
Quote:
Originally Posted by nofish
Do you want to toggle all hardware outs for selected tracks or only the first one?
This should (hopefully) work for all:
Code:
-- Toggle mute hardware outputs for selected tracks
function main()
for i = 0, reaper.CountSelectedTracks(0)-1 do
local tr = reaper.GetSelectedTrack(0, i)
local numHWouts = reaper.GetTrackNumSends(tr, 1)
for j = 0, numHWouts-1 do
-- exclusive OR current state with 1 -> toggle
reaper.SetTrackSendInfo_Value(tr, 1, j, "B_MUTE", reaper.GetTrackSendInfo_Value(tr, 1, j, "B_MUTE")~1)
end -- loop through HW outs
end -- loop through selected tracks
end -- main()
main()
-- https://forum.cockos.com/showpost.php?p=2090533&postcount=27
reaper.Undo_OnStateChangeEx("Toggle mute hardware outputs for selected tracks", 1, -1)
For toggling master/parent send you can use
SetMediaTrackInfo_Value with B_MAINSEND.
|
Your code is much cleaner, thanks!
I did add first selecting tracks that have hardware outputs, then toggle mute, I guess I need unselect also...
Only mute the first HW output.
I'll need to toggle the mp send on when hw out 1 IS muted and off when the hw is NOT muted to get all the way finished.
I will study your code and try to figure out what is going on...
I ended up here (see below)
Code:
--[[
* ReaScript Name: Toggle Mute Hardware Output 1 for Selected Tracks
* Author: Flipotto
* Licence: GPL v3
* REAPER: 5.0 - unsure of version
* Version: .92
--]]
-- Modified from https://forum.cockos.com/showpost.php?p=1651864&postcount=4
-- by airon
-- copied directly me2beats "select all tracks with hardware output"
--[[
The number of hw outs makes all the difference
This version will select tracks with hw outs, only, then
automatically mute hw out 1
reaper.ToggleTrackSendUIMute parameter conditions
*send_idx<0 for receives, >=0 for hw ouputs, >=nb_of_hw_ouputs for sends.
If hw outs are 1 and send_target = -1 the result is zero
--]]
--------Select Track with HW outs---------
function Seltracks_withHWouts()
end
reaper.Main_OnCommand(40297, 0) -- unselect all tracks
t_cnt = reaper.CountTracks(0)
if t_cnt > 0 then
script_title = "select all sends"
reaper.Undo_BeginBlock()
for t = 0, t_cnt-1 do
tr = reaper.GetTrack(0,t)
if reaper.GetTrackNumSends(tr, 1) > 0 then
reaper.SetMediaTrackInfo_Value(tr, 'I_SELECTED', 1)
end
end
reaper.Undo_EndBlock(script_title, -1)
else
reaper.defer(Seltracks_withHWouts)
end
-----------
local send_target = 0 -- just to set a value for the var, send counts start at 0 in Reaper
--------- toggle mute on first HW output ----------
function toggle_send_mute()
local tr_count = reaper.CountSelectedTracks(0)
if tr_count == 0 then
return
end
reaper.Undo_BeginBlock()
for i=1, tr_count do
local tr = reaper.GetSelectedTrack(0, i-1)
if tr ~= nil then
-- count hardware outs (this is needed to get the correct send index)
local tr_num_hw_outs = reaper.GetTrackNumSends(tr, 1)
-- if tr_num_hw_outs == nil or tr_num_hw_outs == 0 then end
-- set send_target equal to numbers of hw outs
local send_target = tr_num_hw_outs
-- subtract the above vars to always get 0, which is the first hw output
reaper.ToggleTrackSendUIMute(tr, tr_num_hw_outs - send_target)-- if >=0,then hw_out
end
end
local undo_string = "Toggle send mute "..tostring(send_target+1)
reaper.Undo_EndBlock(undo_string, -1)
end
--------------
reaper.defer(toggle_send_mute)
how do I run an sws action?
toggle master/parent send on selected tracks
id = _SWS_TOGMPSEND
Last edited by flipotto; 06-10-2021 at 12:22 PM.
|
|
|
06-10-2021, 12:37 PM
|
#2564
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
|
Quote:
Originally Posted by flipotto
how do I run an sws action?
toggle master/parent send on selected tracks
id = _SWS_TOGMPSEND
|
Code:
id = reaper.NamedCommandLookup("_SWS_TOGMPSEND")
reaper.Main_OnCommand(id, 0)
or in one line:
Code:
reaper.Main_OnCommand(reaper.NamedCommandLookup("_SWS_TOGMPSEND"), 0)
edit:
modification of previous script, would this do what you want?
Code:
-- Toggle mute first hardware out and master/parent send for selected tracks
function main()
for i = 0, reaper.CountSelectedTracks(0)-1 do
local tr = reaper.GetSelectedTrack(0, i)
if reaper.GetTrackNumSends(tr, 1) > 0 then
local HWout1_muteState = reaper.GetTrackSendInfo_Value(tr, 1, 0, "B_MUTE")
-- toggle mute first HW out
-- exclusive OR current state with 1 -> toggle
reaper.SetTrackSendInfo_Value(tr, 1, 0, "B_MUTE", HWout1_muteState~1)
-- set master/parent send on if first HW out is muted (off) and vice versa
reaper.SetMediaTrackInfo_Value(tr, "B_MAINSEND", HWout1_muteState~1)
end
end -- loop through selected tracks
end -- main()
main()
-- https://forum.cockos.com/showpost.php?p=2090533&postcount=27
reaper.Undo_OnStateChangeEx("Toggle mute first hardware out and master/parent send for sel. tracks", 1, -1)
Last edited by nofish; 06-10-2021 at 01:29 PM.
|
|
|
06-11-2021, 01:16 AM
|
#2565
|
Human being with feelings
Join Date: Feb 2007
Location: VA
Posts: 885
|
Quote:
Originally Posted by nofish
[code]
or in one line:
Code:
reaper.Main_OnCommand(reaper.NamedCommandLookup("_SWS_TOGMPSEND"), 0)
|
Thanks, that did the trick! But no longer needed/used!
Yes your script does what I was after, however it does not select the tracks with hw outs automatically, which was a new need.
Yours does not have the problem I had of accidently toggling sends that are not hw outs, which is why I did the autoselect tracks with hw out.
Yours also does not flash the selection, which is annoying.
I need to study yours... it's very sleek!
Quote:
Originally Posted by nofish
edit:
modification of previous script, would this do what you want?
Code:
-- Toggle mute first hardware out and master/parent send for selected tracks
function main()
for i = 0, reaper.CountSelectedTracks(0)-1 do
local tr = reaper.GetSelectedTrack(0, i)
if reaper.GetTrackNumSends(tr, 1) > 0 then
local HWout1_muteState = reaper.GetTrackSendInfo_Value(tr, 1, 0, "B_MUTE")
-- toggle mute first HW out
-- exclusive OR current state with 1 -> toggle
reaper.SetTrackSendInfo_Value(tr, 1, 0, "B_MUTE", HWout1_muteState~1)
-- set master/parent send on if first HW out is muted (off) and vice versa
reaper.SetMediaTrackInfo_Value(tr, "B_MAINSEND", HWout1_muteState~1)
end
end -- loop through selected tracks
end -- main()
main()
-- https://forum.cockos.com/showpost.php?p=2090533&postcount=27
reaper.Undo_OnStateChangeEx("Toggle mute first hardware out and master/parent send for sel. tracks", 1, -1)
|
EDIT
Combining Nofish code above and me2beats "select all tracks with hw output".
Code:
--[[
* ReaScript Name: Select Tracks with HW Outs toggle mute hw out 1 inversely toggle master parent send
* Author: Flipotto - just combining other ppls work!
* Licence: GPL v3
* REAPER: 6.29 - unsure of older version compatibility
* Version: .96
Why this script - X32 mixer to toggle between:
-virtual sound check mode(audio from each reaper track to x32 mixer channels for virt sound check)and
-Reaper mix in the box - with only master out to x32
When script runs it should
- Automatically - Select Tracks with HW outputs
- Mute Hw output 1 for the selected tracks
- Toggle on Master parent send for selected tracks
- Unselect selected tracks
TODO -
Send osc message to X32 to toggle between record and play routing mode not sure this is possible...
-- Nofish code - Thanks much! much better without flashing the selection!
-- copied directly me2beats "select all tracks with hardware output"
--]]
-- Toggle mute first hardware out and master/parent send for selected tracks
function main()
-- copied directly me2beats "select all tracks with hardware output"
reaper.Main_OnCommand(40297, 0) -- unselect all tracks
t_cnt = reaper.CountTracks(0)
if t_cnt > 0 then
script_title = "select all sends"
reaper.Undo_BeginBlock()
for t = 0, t_cnt-1 do
tr = reaper.GetTrack(0,t)
if reaper.GetTrackNumSends(tr, 1) > 0 then
reaper.SetMediaTrackInfo_Value(tr, 'I_SELECTED', 1)
end
end
reaper.Undo_EndBlock(script_title, -1)
else
reaper.defer(nothing)
end -- end select tracks with hw outs
-- Nofish code to toggle hw outs
for i = 0, reaper.CountSelectedTracks(0)-1 do
local tr = reaper.GetSelectedTrack(0, i)
if reaper.GetTrackNumSends(tr, 1) > 0 then
local HWout1_muteState = reaper.GetTrackSendInfo_Value(tr, 1, 0, "B_MUTE")
-- toggle mute first HW out
-- exclusive OR current state with 1 -> toggle
reaper.SetTrackSendInfo_Value(tr, 1, 0, "B_MUTE", HWout1_muteState~1)
-- set master/parent send on if first HW out is muted (off) and vice versa
reaper.SetMediaTrackInfo_Value(tr, "B_MAINSEND", HWout1_muteState~1)
end
end -- loop through selected tracks
reaper.Main_OnCommand(40297, 0) -- unselect all tracks
end -- main()
main()
-- https://forum.cockos.com/showpost.php?p=2090533&postcount=27
reaper.Undo_OnStateChangeEx("Toggle mute first hardware out and master/parent send for sel. tracks", 1, -1)
Last edited by flipotto; 06-11-2021 at 04:38 AM.
|
|
|
06-11-2021, 01:06 PM
|
#2566
|
Human being with feelings
Join Date: Feb 2007
Location: VA
Posts: 885
|
Script send osc message to x32 mixer?
Is there a way to send an osc message from a script to a hardware mixer?
|
|
|
06-11-2021, 07:57 PM
|
#2567
|
Human being with feelings
Join Date: Aug 2010
Location: They put me in a home.
Posts: 3,432
|
A Windows app would indeed work I am so grateful for your sharing this. I will test it and get back to you. Can I just copy this into a script or no?
Quote:
Originally Posted by Edgemeal
Would a Windows app work? I've made a few apps that parse REAPER project info. You simply drag and drop project files/folders onto app, exe, or run the included ReaScript (after minor edit) for current project.
Example of text output,
Code:
Project: Gip Seas
-----------------
Master Track:
JS: "TBProAudio/EBUR128LMJSFX/Ed's Tiny_ebu_r128": Eds Mod
Track #1: Pre-Master
VST3: CA-2A (Cakewalk): I Like Cake!
JS: schwa/soft_clipper: This is a comment.
Track #2: Drums
VSTi: MT-PowerDrumKit (MANDA AUDIO) (16 out): Mixer volumes tweaked
VST: Sanford Reverb (Sanford Sound Design): Drum room
etc, etc,..
Run exe from script,
Code:
-- Create project track FX comments text file
-- v1.01 - Edgemeal - June 07, 2021
-- Donate: https://www.paypal.me/Edgemeal
-- *** USER SETTING ***
local exe_path = [[M:\Track FX Comments.exe]] -- full path to Exe.
-- ********************
local _, projfn = reaper.EnumProjects(-1, "")
if projfn ~= "" then
projfn = ' "' .. projfn .. '"' -- prep proj path for exe command-line usage
if reaper.file_exists(exe_path) then
--reaper.ExecProcess(exe_path .. projfn, -1) -- Add project to app, let user run & close.
reaper.ExecProcess(exe_path .. projfn .. ' "*"', -1) -- ' "*"' = Auto create text file and close exe.
else
reaper.MB("The file 'Track FX Comments.exe' was not found!", "ERROR", 0)
end
else
reaper.MB("Please load a project!", "No Project", 0)
end
reaper.defer(function () end)
|
__________________
47.8% of statistics are made up.
|
|
|
06-11-2021, 08:19 PM
|
#2568
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
Quote:
Originally Posted by lowellben
A Windows app would indeed work I am so grateful for your sharing this. I will test it and get back to you. Can I just copy this into a script or no?
|
See readme in zip.
Last edited by Edgemeal; 04-13-2022 at 12:47 PM.
|
|
|
06-12-2021, 06:43 AM
|
#2569
|
Human being with feelings
Join Date: Sep 2019
Posts: 42
|
Script to enable this checkbox
Dear friends can you please help me to enable this check boxes by script?
|
|
|
06-14-2021, 04:23 AM
|
#2570
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
Quote:
Originally Posted by DanSwizer
Dear friends can you please help me to enable this check boxes by script?
|
See post by nofish,
https://forum.cockos.com/showpost.ph...52&postcount=2
For "Snap cursor to edges of media items on any track", CURSOR is documented (8192), but I didn't see anything for SELECTION.
To enable cursor part try,
Code:
reaper.SNM_SetIntConfigVar("projshowgrid", reaper.SNM_GetIntConfigVar("projshowgrid", -666)|8192)
|
|
|
06-14-2021, 04:26 AM
|
#2571
|
Human being with feelings
Join Date: Sep 2019
Posts: 42
|
Quote:
Originally Posted by Edgemeal
See post by nofish,
https://forum.cockos.com/showpost.ph...52&postcount=2
For "Snap cursor to edges of media items on any track", CURSOR is documented (8192), but I didn't see anything for SELECTION.
To enable cursor part try,
Code:
reaper.SNM_SetIntConfigVar("projshowgrid", reaper.SNM_GetIntConfigVar("projshowgrid", -666)|8192)
|
Thank you a lot Man!
|
|
|
06-14-2021, 09:15 AM
|
#2572
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
|
For selection it's the 19th bit (2^18), so
Code:
reaper.SNM_SetIntConfigVar("projshowgrid", reaper.SNM_GetIntConfigVar("projshowgrid", -666)|262144)
(used Meo-Ada Mespotine's Display-Altered-Config-Vars script, thanks)
|
|
|
06-17-2021, 04:57 AM
|
#2573
|
Human being with feelings
Join Date: Sep 2019
Posts: 42
|
Quote:
Originally Posted by nofish
For selection it's the 19th bit (2^18), so
Code:
reaper.SNM_SetIntConfigVar("projshowgrid", reaper.SNM_GetIntConfigVar("projshowgrid", -666)|262144)
(used Meo-Ada Mespotine's Display-Altered-Config-Vars script, thanks)
|
Thank you! I tried it myself but didn't work and this one works!
|
|
|
06-20-2021, 10:10 AM
|
#2574
|
Human being with feelings
Join Date: Apr 2016
Posts: 31
|
Script export Region/Marker Manager .csv inc. Take Markers + 'Info' Column?
Afternoon y'all, would anyone have the know how to make a script that exports the Region/Marker Manager table to .csv and includes the data on Take Markers and the 'Info' column (which for reasons unknown does NOT get exported using the standard 'Export Regions/Markers' to .csv option)?
The main advantage of Take Markers over normal Markers is that they can be designated by channel, so missing this info when they are exported to .csv vastly limits their (quite significant and as yet untapped) utility.
Should you need examples, these are just a few use cases:
- Generating a list or checklist of tasks for the project(s) via Take Marker annotations. - This can then be exported e.g for use in a task manager or To-Do app, or emailed amongst collaborators to delegate tasks - The channel/subchannel info allows for much easier and more efficient task management and categorisation than just the standard Markers which do not include that info
- Creating lyrics for channels within Reaper - These can be used in project for display or to sing along to when it comes to studio or live use - Exported and put in a songbook or note type programme like Evernote or Notion
- Creating more effective alerts within Reaper than by simply using standard Markers (which don't show which channel they refer to/are difficult to distinguish if there are too many in one place)
If someone does this and distributes it for community use, I would be very happy to set up the Excel/Power Query worksheet to transform that .csv information into a machine readable set of tasks and distribute it for free/community use (provided that's allowed?). I'd also be eternally grateful and I am open to negotatiating other deals, I just don't have the know how to script myself otherwise I'd do it.
Many thanks y'all ! Feel free to PM me
Last edited by JimmyDeLancia; 06-20-2021 at 10:17 AM.
|
|
|
06-20-2021, 10:41 AM
|
#2575
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
Quote:
Originally Posted by JimmyDeLancia
Afternoon y'all, would anyone have the know how to make a script that exports the Region/Marker Manager table to .csv and includes the data on Take Markers and the 'Info' column (which for reasons unknown does NOT get exported using the standard 'Export Regions/Markers' to .csv option)?
|
Using js_ReaScriptAPI extension we can get the displayed text in that manager window, maybe a Lua script something like this would work for you,..
EDIT
May require REAPER v6.28 or later, see https://forum.cockos.com/showthread.php?t=241880
Code:
-- Save selected Region Marker Manager items to csv file
-- Note: The Color column is not supported!
function GetSelectedLvItems(hwnd)
local lines = {}
lines[1] = '#,Name,Start,End,Length,Render Matrix,Info'
local sel_count, sel_indexes = reaper.JS_ListView_ListAllSelItems(hwnd)
if sel_count == 0 and reaper.MB('No items selected! Abort file write?', 'Warning!' ,4) == 6 then return end
for row in string.gmatch(sel_indexes, '[^,]+') do
local items = ""
for column = 1, 7 do
items = items .. reaper.JS_ListView_GetItemText(hwnd, tonumber(row), column) .. ((column < 7) and ',' or '')
end
lines[#lines+1] = items
end
return lines
end
function Main()
local title = reaper.JS_Localize('Region/Marker Manager', 'common')
local manager = reaper.JS_Window_Find(title, true)
if manager then
local lv = reaper.JS_Window_FindChild(manager, 'List2', true)
if lv then
local t = GetSelectedLvItems(lv)
if t then
local f = io.open(reaper.GetProjectPath("") .. '\\Region marker manager.csv', "w")
f:write(table.concat(t,"\n"))
f:close()
end
end
end
end
if not reaper.APIExists('JS_Localize') then
reaper.MB('js_ReaScriptAPI extension is required for this script.', 'Extension Not Found', 0)
else
Main()
reaper.defer(function () end)
end
Last edited by Edgemeal; 06-20-2021 at 03:34 PM.
|
|
|
07-12-2021, 02:47 PM
|
#2576
|
Human being with feelings
Join Date: May 2013
Location: New York
Posts: 781
|
Wondering if someone could whip up a script that changes the volume envelope scaling on all selected takes to fader scaling. I've found ones in Reapack that do this for track volume envelopes, but they don't work on take envelopes.
|
|
|
07-12-2021, 03:16 PM
|
#2577
|
Human being with feelings
Join Date: Jul 2007
Location: New Joisey
Posts: 5,989
|
I'd love it if it were possible to code a script or macro to allow for MIDI Cycle Recording into separate clips, without having to manually drop in and out of the recording at each pass.
I've been playing around with trying to create an action to do this, but it doesn't drop out and back into recording mode as I wished. But the series of actions I'm looking for is basically this:
40496 - Track: Set track record mode to input
41329 - Options: New Recording creates media items in new lanes
40919 - Item: set item mi behavior to always mix
_SWS_SETONMEDIA - Set selected track(S) monitor track media while recording
Transport: Record [to start recording]
...Wait until end of loop
Transport: Record [to punch out]
Transport: Record [again - to re-engage recording)
...this would allow for each loop pass to create a new MIDI clip that could then be individually edited. It works if I manually drop do this, with the dropping out of record mode and back in, but I'd like a process that did this for me without having to manually stop and do that.
Any ideas would be welcome.
|
|
|
07-19-2021, 11:23 AM
|
#2578
|
Human being with feelings
Join Date: Jun 2017
Posts: 21
|
Set Time Selection from Edit Cursor to Previous Region Edge
I've searched as best I can, but I'm guessing I have too many variables for my query. I would like to know if it's possible to set the time selection from the edit cursor to the end of the previous region? I do have SWS Extensions installed but I have no clue how to create my own scripts.
|
|
|
07-19-2021, 12:22 PM
|
#2579
|
Human being with feelings
Join Date: Sep 2014
Posts: 2,643
|
Quote:
Originally Posted by psycharm
I've searched as best I can, but I'm guessing I have too many variables for my query. I would like to know if it's possible to set the time selection from the edit cursor to the end of the previous region? I do have SWS Extensions installed but I have no clue how to create my own scripts.
|
Code:
time = reaper.GetCursorPosition()
markeridxOut, regionidx = reaper.GetLastMarkerAndCurRegion(0, time)
retval, isrgnOut, posOut, rgnendOut, nameOut, markrgnindexnumberOut, colorOut = reaper.EnumProjectMarkers3(0, regionidx)
start_time, end_time = reaper.GetSet_LoopTimeRange(true, true, posOut, time, 0)
if you want to go back to the start of the previous region change
regionidx -1)
|
|
|
07-19-2021, 12:44 PM
|
#2580
|
Human being with feelings
Join Date: Jun 2017
Posts: 21
|
Quote:
Originally Posted by MusoBob
Code:
time = reaper.GetCursorPosition()
markeridxOut, regionidx = reaper.GetLastMarkerAndCurRegion(0, time)
retval, isrgnOut, posOut, rgnendOut, nameOut, markrgnindexnumberOut, colorOut = reaper.EnumProjectMarkers3(0, regionidx)
start_time, end_time = reaper.GetSet_LoopTimeRange(true, true, posOut, time, 0)
if you want to go back to the start of the previous region change
regionidx -1)
|
Thank you so much for your quick response! I created a new lua action and copy/pasted the code, but when I run it, it selects from the edit cursor to the beginning of the session. I'm not sure if I'm doing something wrong as this is my first time creating an action. I'm attaching a screenshot of the ReaScript window.
|
|
|
07-19-2021, 01:05 PM
|
#2581
|
Human being with feelings
Join Date: Sep 2014
Posts: 2,643
|
So if you add regionidx -1) that will focus on the previous region from the cursor pos.
posOut is the start pos of that region
rgnendOut is the end pos of that region
time is the cursor pos
reaper.GetSet_LoopTimeRange(true, true, posOut, time, 0)
so it sets the time selection start to posOut (region start)
and the time selection end to time (cursor pos)
so if you want to set it to the end of the previous region use
regionidx -1) and
reaper.GetSet_LoopTimeRange(true, true, rgnendOut, time, 0)
|
|
|
07-19-2021, 01:10 PM
|
#2582
|
Human being with feelings
Join Date: Sep 2014
Posts: 2,643
|
Also you can set the isLoop to false if you don't want the play to loop that section.
start, end = reaper.GetSet_LoopTimeRange2( proj, isSet, isLoop, start, end, allowautoseek )
|
|
|
07-19-2021, 01:21 PM
|
#2583
|
Human being with feelings
Join Date: Jun 2017
Posts: 21
|
Quote:
Originally Posted by MusoBob
So if you add regionidx -1) that will focus on the previous region from the cursor pos.
posOut is the start pos of that region
rgnendOut is the end pos of that region
time is the cursor pos
reaper.GetSet_LoopTimeRange(true, true, posOut, time, 0)
so it sets the time selection start to posOut (region start)
and the time selection end to time (cursor pos)
so if you want to set it to the end of the previous region use
regionidx -1) and
reaper.GetSet_LoopTimeRange(true, true, rgnendOut, time, 0)
|
Oh, okay. I see from your example I neglected to properly explain what I'm trying to do. I want to easily create a time selection from the edit cursor to the end of the previous region outside of a region in order to create a new region. Hopefully, that makes more sense. I make imaging for radio stations and that usually requires creating several regions in a project to render as separate files. I greatly appreciate your help!
|
|
|
07-19-2021, 03:34 PM
|
#2584
|
Human being with feelings
Join Date: Sep 2014
Posts: 2,643
|
Like this ?
Code:
time = reaper.GetCursorPosition()
markeridxOut, regionidx = reaper.GetLastMarkerAndCurRegion(0, time)
retval, isrgnOut, posOut, rgnendOut, nameOut, markrgnindexnumberOut, colorOut = reaper.EnumProjectMarkers3(0, regionidx -1)
start_time, end_time = reaper.GetSet_LoopTimeRange(true, true, rgnendOut, time, 0)
reaper.Main_OnCommand( 40174, 0 ) -- Markers: Insert region from time selection
If you right click on the reaper action and copy the ID
reaper.Main_OnCommand( 40174, 0 )
or if it's not a native reaper script
command01 = reaper.NamedCommandLookup( "_RSdb42014926973c7f583c679cff3fafea81164d25" )
reaper.Main_OnCommand( command01, 0 )
you can take it further and name and color the region if you like.
|
|
|
07-19-2021, 03:59 PM
|
#2585
|
Human being with feelings
Join Date: Jun 2017
Posts: 21
|
Quote:
Originally Posted by MusoBob
Like this ?
Code:
time = reaper.GetCursorPosition()
markeridxOut, regionidx = reaper.GetLastMarkerAndCurRegion(0, time)
retval, isrgnOut, posOut, rgnendOut, nameOut, markrgnindexnumberOut, colorOut = reaper.EnumProjectMarkers3(0, regionidx -1)
start_time, end_time = reaper.GetSet_LoopTimeRange(true, true, rgnendOut, time, 0)
reaper.Main_OnCommand( 40174, 0 ) -- Markers: Insert region from time selection
If you right click on the reaper action and copy the ID
reaper.Main_OnCommand( 40174, 0 )
or if it's not a native reaper script
command01 = reaper.NamedCommandLookup( "_RSdb42014926973c7f583c679cff3fafea81164d25" )
reaper.Main_OnCommand( command01, 0 )
you can take it further and name and color the region if you like.
|
Thank you again for your assistance. I'm not sure how to make a gif to show you what I'm talking about, but I place the edit cursor outside the last region, I would like to create a time selection from the edit cursor to the right edge of that last region so that I can then create a new region. For your script to work as expected, at least in my experience thus far, I have to place the edit cursor inside an existing region. Otherwise, it creates a time selection (and now region as well) from the edit cursor to the beginning of the project. I apologize for not being more clear. I have the idea in my head, I'm just having difficulty verbalizing it. Ha ha ha!!!
|
|
|
07-19-2021, 05:54 PM
|
#2586
|
Human being with feelings
Join Date: Sep 2014
Posts: 2,643
|
Code:
function previous_region()
edit_pos = reaper.GetCursorPosition()
play = reaper.GetPlayState()
if play > 0 then
pos = reaper.GetPlayPosition()
else
pos = edit_pos
end
count_markers_regions, count_markersOut, count_regionsOut = reaper.CountProjectMarkers(0)
i=1
repeat
iRetval, bIsrgnOut, iPosOut, iRgnendOut, sNameOut, iMarkrgnindexnumberOut, iColorOur = reaper.EnumProjectMarkers3(0,count_markers_regions-i)
if iRetval >= 1 then
if bIsrgnOut == true and iPosOut < pos then
-- ACTION ON REGIONS HERE
reaper.SetEditCurPos(iPosOut,true,true) -- moveview and seekplay
break
end
i = i+1
end
until iRetval == 0
end
current_cur_pos = reaper.GetCursorPosition()
previous_region()
time = reaper.GetCursorPosition()
markeridxOut, regionidx = reaper.GetLastMarkerAndCurRegion(0, time)
retval, isrgnOut, posOut, rgnendOut, nameOut, markrgnindexnumberOut, colorOut = reaper.EnumProjectMarkers3(0, regionidx )
start_time, end_time = reaper.GetSet_LoopTimeRange(true, true, rgnendOut, current_cur_pos, 0)
reaper.SetEditCurPos2( 0, current_cur_pos, 0, 0 )
reaper.Main_OnCommand( 40174, 0 ) -- Markers: Insert region from time selection
reaper.Main_OnCommand( 40635, 0 ) -- Time selection: Remove time selection
|
|
|
07-19-2021, 10:11 PM
|
#2587
|
Human being with feelings
Join Date: Jun 2017
Posts: 21
|
Quote:
Originally Posted by MusoBob
Code:
function previous_region()
edit_pos = reaper.GetCursorPosition()
play = reaper.GetPlayState()
if play > 0 then
pos = reaper.GetPlayPosition()
else
pos = edit_pos
end
count_markers_regions, count_markersOut, count_regionsOut = reaper.CountProjectMarkers(0)
i=1
repeat
iRetval, bIsrgnOut, iPosOut, iRgnendOut, sNameOut, iMarkrgnindexnumberOut, iColorOur = reaper.EnumProjectMarkers3(0,count_markers_regions-i)
if iRetval >= 1 then
if bIsrgnOut == true and iPosOut < pos then
-- ACTION ON REGIONS HERE
reaper.SetEditCurPos(iPosOut,true,true) -- moveview and seekplay
break
end
i = i+1
end
until iRetval == 0
end
current_cur_pos = reaper.GetCursorPosition()
previous_region()
time = reaper.GetCursorPosition()
markeridxOut, regionidx = reaper.GetLastMarkerAndCurRegion(0, time)
retval, isrgnOut, posOut, rgnendOut, nameOut, markrgnindexnumberOut, colorOut = reaper.EnumProjectMarkers3(0, regionidx )
start_time, end_time = reaper.GetSet_LoopTimeRange(true, true, rgnendOut, current_cur_pos, 0)
reaper.SetEditCurPos2( 0, current_cur_pos, 0, 0 )
reaper.Main_OnCommand( 40174, 0 ) -- Markers: Insert region from time selection
reaper.Main_OnCommand( 40635, 0 ) -- Time selection: Remove time selection
|
That's it! Thank you so much!!!
|
|
|
07-30-2021, 05:00 AM
|
#2588
|
Human being with feelings
Join Date: Aug 2020
Posts: 276
|
Looking for a script that can "restore" the items length, start and end points to its original length. Any that could help me with that?
|
|
|
07-30-2021, 12:34 PM
|
#2589
|
Human being with feelings
Join Date: Dec 2017
Location: Brazil
Posts: 1,992
|
hans: there is more than one way to do it.
You want the item to keep the start position in the project and just move the source inside it to start at source start + its length to end at source end
or you want to drag the start of item to the start of the source and the end of the item to the end of the source?
Also any chance your items are with playrate different than 1?
for the first scenario
Code:
local item = reaper.GetSelectedMediaItem(0, 0)
local take = reaper.GetMediaItemTake(item, 0)
local source = reaper.GetMediaItemTake_Source( take )
reaper.SetMediaItemTakeInfo_Value( take, 'D_STARTOFFS' , 0 )
local len, lengthIsQN = reaper.GetMediaSourceLength( source )
reaper.SetMediaItemLength(item, len, true)
|
|
|
07-31-2021, 05:29 PM
|
#2590
|
Human being with feelings
Join Date: Feb 2019
Posts: 586
|
Have a request for something that's hopefully simple. I asked if there was a way to do it already in the other parts of the forum but no answers, so I'm guessing it's gotta be a script.
Looking to remove take envelopes from selected item(s). There's an action
"SWS/S&M: Hide and bypass take volume envelope" which works to disable them, but if I later go back to the item and open the take envelope the old points are still there.
"Envelope: Clear or remove envelope" works but only on a single selected envelope, so it's not possible to select an entire project's items and remove the envelopes. This comes up in post-production, depending on how files are imported they can have envelopes baked in.
Thanks in advance for anybody who wants to take a crack at it.
|
|
|
07-31-2021, 10:36 PM
|
#2591
|
Human being with feelings
Join Date: Apr 2020
Posts: 1,501
|
Quote:
Originally Posted by fakemaxwell
Have a request for something that's hopefully simple. I asked if there was a way to do it already in the other parts of the forum but no answers, so I'm guessing it's gotta be a script.
Looking to remove take envelopes from selected item(s). There's an action
"SWS/S&M: Hide and bypass take volume envelope" which works to disable them, but if I later go back to the item and open the take envelope the old points are still there.
"Envelope: Clear or remove envelope" works but only on a single selected envelope, so it's not possible to select an entire project's items and remove the envelopes. This comes up in post-production, depending on how files are imported they can have envelopes baked in.
Thanks in advance for anybody who wants to take a crack at it.
|
Amagalma has a script called "Clear multiple track envelopes for all selected tracks or for all tracks in project" which can be found on ReaPack. But that one works for track envelopes only. So is it usable for you?
|
|
|
08-01-2021, 05:29 AM
|
#2592
|
Human being with feelings
Join Date: Aug 2020
Posts: 276
|
Thanks a lot!
It's actually the second way I'm looking a script for.
No other playrate than 1 on the items.
Thanks daniellumertz!
Quote:
Originally Posted by daniellumertz
hans: there is more than one way to do it.
You want the item to keep the start position in the project and just move the source inside it to start at source start + its length to end at source end
or you want to drag the start of item to the start of the source and the end of the item to the end of the source?
Also any chance your items are with playrate different than 1?
for the first scenario
Code:
local item = reaper.GetSelectedMediaItem(0, 0)
local take = reaper.GetMediaItemTake(item, 0)
local source = reaper.GetMediaItemTake_Source( take )
reaper.SetMediaItemTakeInfo_Value( take, 'D_STARTOFFS' , 0 )
local len, lengthIsQN = reaper.GetMediaSourceLength( source )
reaper.SetMediaItemLength(item, len, true)
|
Last edited by hans; 08-01-2021 at 05:36 AM.
Reason: adding infoo
|
|
|
08-01-2021, 06:39 AM
|
#2593
|
Human being with feelings
Join Date: Apr 2020
Posts: 1,501
|
Hi!
Would it be possible to get a script that selects all regions in the project?
Thanks,
PW
Edit: In the Region Manager I mean
Last edited by Pink Wool; 08-01-2021 at 07:11 AM.
|
|
|
08-01-2021, 09:32 AM
|
#2594
|
Human being with feelings
Join Date: Feb 2019
Posts: 586
|
Quote:
Originally Posted by Pink Wool
Amagalma has a script called "Clear multiple track envelopes for all selected tracks or for all tracks in project" which can be found on ReaPack. But that one works for track envelopes only. So is it usable for you?
|
That is indeed a useful script, but unfortunately it doesn't solve this particular problem.
|
|
|
08-01-2021, 01:20 PM
|
#2595
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Quote:
Originally Posted by fakemaxwell
That is indeed a useful script, but unfortunately it doesn't solve this particular problem.
|
Try this:
Code:
local item_cnt = reaper.CountSelectedMediaItems(0)
if item_cnt == 0 then return reaper.defer(function() end) end
reaper.PreventUIRefresh( 1 )
for i = 0, item_cnt-1 do
local item = reaper.GetSelectedMediaItem( 0, i )
local _, chunk = reaper.GetItemStateChunk( item, "", false )
local t, c = {}, 0
local record = true
for line in chunk:gmatch("[^\n]+") do
if line:match("^<%u+ENV$") or line:match("^<PARMENV ") then
record = false
end
if record then
c = c +1
t[c] = line
end
if record == false and line == ">" then
record = true
end
end
reaper.SetItemStateChunk( item, table.concat(t, "\n"), false )
end
reaper.PreventUIRefresh( -1 )
reaper.UpdateArrange()
reaper.Undo_OnStateChange("Delete all take envelopes for selected items")
Do you want the FX parameter modulation to be cleared too? If yes, then the line in bold should be:
Code:
if line:match("^<%u+ENV$") or line:match("^<PARMENV ") or line:match("^<PROGRAMENV ") then
Last edited by amagalma; 08-01-2021 at 01:31 PM.
|
|
|
08-01-2021, 03:19 PM
|
#2596
|
Human being with feelings
Join Date: Sep 2014
Posts: 2,643
|
Quote:
Originally Posted by Pink Wool
Hi!
Would it be possible to get a script that selects all regions in the project?
Thanks,
PW
Edit: In the Region Manager I mean
|
ctrl+A
https://forum.cockos.com/showthread.php?t=255987
|
|
|
08-02-2021, 03:36 AM
|
#2597
|
Human being with feelings
Join Date: Aug 2020
Posts: 276
|
I have a problem where i need some sort of script.
When I want to de-click an area of an item, i split the item at time selection, and add a De-clicker VST on it. The problem here is that all the de-clickers i have tried interprets the non-zero crossings at the start and end of the newly split item as clicks. I want the in and ends to be untouched by the de-clicker.
I'm used to this workflow with various de-clicking AAX plugins from back in the day when i used Pro tools and wish to do this in Reaper as well.
The best way to solve this would be a script that splits the item at closest zero points of the time selection? Or any other ideas?
|
|
|
08-02-2021, 07:33 AM
|
#2598
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
|
Quote:
Originally Posted by hans
I have a problem where i need some sort of script.
When I want to de-click an area of an item, i split the item at time selection, and add a De-clicker VST on it. The problem here is that all the de-clickers i have tried interprets the non-zero crossings at the start and end of the newly split item as clicks. I want the in and ends to be untouched by the de-clicker.
I'm used to this workflow with various de-clicking AAX plugins from back in the day when i used Pro tools and wish to do this in Reaper as well.
The best way to solve this would be a script that splits the item at closest zero points of the time selection? Or any other ideas?
|
Maybe a custom action something like this (didn't test)?
Go to start of time selection
Move edit cursor to next zero crossing in items
Item: Split items at edit cursor (no change selection)
Go to end of time selection
Move edit cursor to previous zero crossing in items
Item: Split items at edit cursor (no change selection)
|
|
|
08-02-2021, 07:49 AM
|
#2599
|
Human being with feelings
Join Date: Apr 2020
Posts: 1,501
|
Quote:
Originally Posted by MusoBob
|
Okay, my fault! I explained this one badly. So what I'm looking for is a script that could select all the regions WITHOUT opening the Region Manager. Or one that would at least close it afterwords.
Would this be possible?
Edit: So here's what I'm trying to achieve; Regions have round corners when they aren't selected. I want them to have square ones. So I want them automatically selected with a script. I know this is stupid and trivial at best but darn, I just hate the look of round corners on my regions!
Last edited by Pink Wool; 08-02-2021 at 08:00 AM.
|
|
|
08-03-2021, 01:08 AM
|
#2600
|
Human being with feelings
Join Date: Aug 2020
Posts: 276
|
Works really good Thank you!
Quote:
Originally Posted by nofish
Maybe a custom action something like this (didn't test)?
Go to start of time selection
Move edit cursor to next zero crossing in items
Item: Split items at edit cursor (no change selection)
Go to end of time selection
Move edit cursor to previous zero crossing in items
Item: Split items at edit cursor (no change selection)
|
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 05:37 AM.
|