Old 11-09-2020, 01:42 AM   #2281
Repaer
Human being with feelings
 
Repaer's Avatar
 
Join Date: Aug 2009
Location: France
Posts: 93
Default

Hi everyone!

I'm looking for a way to make a simple script that would remove just a few milliseconds of audio at the start and at the end of selected takes. How can I do that?
__________________
http://www.florian-calmer.com/
Repaer is offline   Reply With Quote
Old 11-09-2020, 02:32 AM   #2282
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Quote:
Originally Posted by Repaer View Post
Hi everyone!

I'm looking for a way to make a simple script that would remove just a few milliseconds of audio at the start and at the end of selected takes. How can I do that?
Hello!

Do you mean from the audio file itself or from the item? Do the selected items contain more than one take? Fixed amount of ms or set by user each time script is run? A gif or a more detailed explanation would help
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 11-09-2020, 03:04 AM   #2283
Repaer
Human being with feelings
 
Repaer's Avatar
 
Join Date: Aug 2009
Location: France
Posts: 93
Default

Quote:
Originally Posted by amagalma View Post
Hello!

Do you mean from the audio file itself or from the item? Do the selected items contain more than one take? Fixed amount of ms or set by user each time script is run? A gif or a more detailed explanation would help
Hi! From the selected items. Only one take and a fixed amount would be perfect.
I'd like to do that because I convert my sessions to ProTools with AAtranslator and, sometimes, some items are considered as loops which ProTools doesn't like. So I have to manually trim a little bit from the item in order to make those items not loops.

Here's the action I'd like to automate.

I don't have a specific amount of milliseconds in mind, I think just a few would be enough to work.
__________________
http://www.florian-calmer.com/
Repaer is offline   Reply With Quote
Old 11-09-2020, 08:23 AM   #2284
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Quote:
Originally Posted by Repaer View Post
Hi! From the selected items. Only one take and a fixed amount would be perfect.
I'd like to do that because I convert my sessions to ProTools with AAtranslator and, sometimes, some items are considered as loops which ProTools doesn't like. So I have to manually trim a little bit from the item in order to make those items not loops.

Here's the action I'd like to automate.

I don't have a specific amount of milliseconds in mind, I think just a few would be enough to work.

You need SWS for the script to work:

Code:
local change = 3 -- set change in milliseconds here

local item_cnt = reaper.CountSelectedMediaItems( 0 )
if item_cnt == 0 then return end

local val = change / 1000
for i = 0, item_cnt-1 do
  local item = reaper.GetSelectedMediaItem( 0, i )
  local i_pos = reaper.GetMediaItemInfo_Value( item, "D_POSITION" )
  local i_end = i_pos + reaper.GetMediaItemInfo_Value( item, "D_LENGTH" )
  reaper.BR_SetItemEdges( item, i_pos + val, i_end - val )
end
reaper.Undo_OnStateChange( "Trim both item edges by " .. change .. " ms" )
You can check if your items loop if you press F2 and see if "Loop source" is checked
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 11-09-2020, 08:31 AM   #2285
Repaer
Human being with feelings
 
Repaer's Avatar
 
Join Date: Aug 2009
Location: France
Posts: 93
Default

Quote:
Originally Posted by amagalma View Post

You can check if your items loop if you press F2 and see if "Loop source" is checked
Ha yes good point!

Thank you so much! The script works great!
__________________
http://www.florian-calmer.com/
Repaer is offline   Reply With Quote
Old 11-09-2020, 02:19 PM   #2286
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 1,180
Default

I know you code people are busy but we're stuck with JS_API screen coordinates on mac:

https://forum.cockos.com/showthread....09#post2362809

Any help much appreciated
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is offline   Reply With Quote
Old 11-10-2020, 12:51 AM   #2287
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Quote:
Originally Posted by Triode View Post
I know you code people are busy but we're stuck with JS_API screen coordinates on mac:

https://forum.cockos.com/showthread....09#post2362809

Any help much appreciated

Just saw this.. It looks like FeedTheCat has solved the issue
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 11-12-2020, 12:43 PM   #2288
Loulou92
Human being with feelings
 
Loulou92's Avatar
 
Join Date: Sep 2015
Location: Paris
Posts: 544
Default [SOLVED] Copy and paste selected fx with automation

Hello,

"Copy focused fx (with automation) to selected track" by me2beats is the only script that allow to copy an fx with its envelopes to another track (via action, I mean). But it's maybe an old script, because it doesn't always work as expected, it's very very picky (Sometimes it works, sometimes it doesn't , and I'm not sure why...). Could someone try to create something similar, maybe more sturdy with the current Reaper state of development ? Even Maybe a pair of action : Copy, then paste ?

An action like this would be very interesting in my opinion.

Hopefully my request will inspire someone .

Have a nice day !
xxxxxxxxxxxxxx

Last edited by Loulou92; 11-16-2020 at 04:44 AM.
Loulou92 is offline   Reply With Quote
Old 11-14-2020, 09:52 AM   #2289
Loulou92
Human being with feelings
 
Loulou92's Avatar
 
Join Date: Sep 2015
Location: Paris
Posts: 544
Default [SOLVED]

Hey, so regarding my message above, it seems that the me2beats script works in custom action, but only if you open manually the fx chain window containing the fx. The script has difficulties to find the last focused fx if you don't do that and you select it via scripts instead (Cfillion has made a script that allow you to select an fx based on its name, this is what I use inside the custom action).

So while the script works fine for regular use (you select the fx and the track manually and launch the script), it won't be reliable if you select focused fx and target track via custom action instructions (scripts, SWS console).

Me2beats isn't active in the forum anymore. I'll donate money if someone can solve this, or design something that works inside a custom action !
xxx

EDIT : I spent hours trying to make the me2beats script work, but it really doesn't inside cycle actions .
EDIT 2 :X-Raym is on it, via his script design service.
EDIT 3 : Done by X-Raym.

Last edited by Loulou92; 11-16-2020 at 04:44 AM.
Loulou92 is offline   Reply With Quote
Old 11-20-2020, 06:15 AM   #2290
hans
Human being with feelings
 
Join Date: Aug 2020
Posts: 276
Default Select items by sample rate

Hi!

Working with lots of recordings on 192khz and 96 khz sample rate and I'd be happy if there was an easy way to select all 96k files for example and move them to another track and have the files separately.

It is necessary for me to ask for a script or is there a solution I'm not aware of?
hans is offline   Reply With Quote
Old 11-20-2020, 08:37 AM   #2291
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

Quote:
Originally Posted by hans View Post
Hi!

Working with lots of recordings on 192khz and 96 khz sample rate and I'd be happy if there was an easy way to select all 96k files for example and move them to another track and have the files separately.

It is necessary for me to ask for a script or is there a solution I'm not aware of?
Maybe make a custom action, use lua script below to select only the 96kHz items, followed by, "Script: me2beats_Move items to selected track.lua" which you can find on ReaPack.

Code:
-- Select items 96kHz sample rate.lua

reaper.PreventUIRefresh(1)
reaper.Undo_BeginBlock()
reaper.Main_OnCommand(40289, 0) -- Item: Unselect all items
local item_cnt = reaper.CountMediaItems(0)-1
for i = 0, item_cnt do
  local item = reaper.GetMediaItem(0, i)
  local take = reaper.GetActiveTake(item)
  if take ~= nil and not reaper.TakeIsMIDI(take) then 
    local PCM_source = reaper.GetMediaItemTake_Source(take, "")
    if reaper.GetMediaSourceSampleRate(PCM_source) == 96000 then
      reaper.SetMediaItemSelected(item, true)
    end
  end
end 
reaper.Undo_EndBlock('Select items 96kHz sample rate', -1) 
reaper.UpdateArrange()
reaper.PreventUIRefresh(-1)
Edgemeal is offline   Reply With Quote
Old 11-21-2020, 12:47 AM   #2292
PitchSlap
Human being with feelings
 
PitchSlap's Avatar
 
Join Date: Jan 2008
Location: Vancouver, BC
Posts: 3,793
Default

I'm wondering if someone would be able to make a simple script to rename the selected tracks by removing a certain number of characters from the start of the name?

For example:
"xx - trackname"
becomes
"trackname"

I have all my samples renamed with some leading descriptions so they are easy to find and sort when browsing, but after being added to the project it's unnecessary in the track name and I find myself spending a lot of time manually renaming 50-100 tracks.

Thanks in advance if anyone takes a shot at it.
__________________
FRs: v5 Media Explorer Requests, Global Quantization, Session View
Win10 Pro 64-bit, Reaper 6(x64), AMD 3950x, Aorus X570 Master, 64GB DDR4 3600, PowerColor Red Devil 5700XT, EVO 970 2TB, 10TB HD, Define R6
PitchSlap is offline   Reply With Quote
Old 11-21-2020, 01:55 AM   #2293
Pink Wool
Human being with feelings
 
Pink Wool's Avatar
 
Join Date: Apr 2020
Posts: 1,501
Default

Quote:
Originally Posted by PitchSlap View Post
I'm wondering if someone would be able to make a simple script to rename the selected tracks by removing a certain number of characters from the start of the name?

For example:
"xx - trackname"
becomes
"trackname"

I have all my samples renamed with some leading descriptions so they are easy to find and sort when browsing, but after being added to the project it's unnecessary in the track name and I find myself spending a lot of time manually renaming 50-100 tracks.

Thanks in advance if anyone takes a shot at it.

https://forum.cockos.com/showthread....ghlight=rename
Pink Wool is offline   Reply With Quote
Old 11-21-2020, 12:50 PM   #2294
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default

Quote:
Originally Posted by PitchSlap View Post
I'm wondering if someone would be able to make a simple script to rename the selected tracks by removing a certain number of characters from the start of the name?.....
mpl_Delete x characters from selected track names.eel
right click on the Raw button Save Link As
or if you have ReaPack use that.
__________________
ReaTrakStudio Chord Track for Reaper forum
www.reatrak.com
STASH Downloads https://stash.reaper.fm/u/ReaTrak
MusoBob is offline   Reply With Quote
Old 11-22-2020, 12:33 AM   #2295
PitchSlap
Human being with feelings
 
PitchSlap's Avatar
 
Join Date: Jan 2008
Location: Vancouver, BC
Posts: 3,793
Default

Quote:
Originally Posted by Pink Wool View Post
Quote:
Originally Posted by MusoBob View Post
mpl_Delete x characters from selected track names.eel
right click on the Raw button Save Link As
or if you have ReaPack use that.
Thanks guys!
I checked ReaPack, but couldn't find what I was looking for.
__________________
FRs: v5 Media Explorer Requests, Global Quantization, Session View
Win10 Pro 64-bit, Reaper 6(x64), AMD 3950x, Aorus X570 Master, 64GB DDR4 3600, PowerColor Red Devil 5700XT, EVO 970 2TB, 10TB HD, Define R6
PitchSlap is offline   Reply With Quote
Old 11-22-2020, 05:38 AM   #2296
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default

Quote:
Originally Posted by PitchSlap View Post
Thanks guys!
I checked ReaPack, but couldn't find what I was looking for.
Delete x characters from selected track names
__________________
ReaTrakStudio Chord Track for Reaper forum
www.reatrak.com
STASH Downloads https://stash.reaper.fm/u/ReaTrak
MusoBob is offline   Reply With Quote
Old 11-22-2020, 07:02 PM   #2297
Loulou92
Human being with feelings
 
Loulou92's Avatar
 
Join Date: Sep 2015
Location: Paris
Posts: 544
Default

Hey

Could a lua script set or unset selected tracks VCA Follow attribute to group n ?

"Set selected tracks as VCA Follow in group 30"
"Unset selected tracks as VCA Follow in group 30"
[...]

Any help appreciated !
xxxxxxxxxxxxxxx

EDIT : X-Raym is cooking something. (ok, done !)

Last edited by Loulou92; 12-10-2020 at 03:20 PM.
Loulou92 is offline   Reply With Quote
Old 11-23-2020, 02:58 AM   #2298
hans
Human being with feelings
 
Join Date: Aug 2020
Posts: 276
Default

Quote:
Originally Posted by Edgemeal View Post
Maybe make a custom action, use lua script below to select only the 96kHz items, followed by, "Script: me2beats_Move items to selected track.lua" which you can find on ReaPack.

Code:
-- Select items 96kHz sample rate.lua

reaper.PreventUIRefresh(1)
reaper.Undo_BeginBlock()
reaper.Main_OnCommand(40289, 0) -- Item: Unselect all items
local item_cnt = reaper.CountMediaItems(0)-1
for i = 0, item_cnt do
  local item = reaper.GetMediaItem(0, i)
  local take = reaper.GetActiveTake(item)
  if take ~= nil and not reaper.TakeIsMIDI(take) then 
    local PCM_source = reaper.GetMediaItemTake_Source(take, "")
    if reaper.GetMediaSourceSampleRate(PCM_source) == 96000 then
      reaper.SetMediaItemSelected(item, true)
    end
  end
end 
reaper.Undo_EndBlock('Select items 96kHz sample rate', -1) 
reaper.UpdateArrange()
reaper.PreventUIRefresh(-1)
Thanks a lot for that, Edgemeal!
hans is offline   Reply With Quote
Old 11-27-2020, 07:29 PM   #2299
Joe90
Human being with feelings
 
Join Date: Aug 2019
Posts: 853
Default Toggle float last touched FX?

Hi All,

I'm looking for a script to toggle opening/closing the last touched (or last viewed/floated) FX. Bonus points if it also incorporates this script -

SWS/BR: Move active floating track FX window to mouse cursor (horizontal: middle, vertical: middle)

so that the when floating the FX it always appears centered over the mouse cursor.

Thanks.
Joe90 is offline   Reply With Quote
Old 11-28-2020, 09:47 AM   #2300
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

Nevermind

Last edited by Edgemeal; 02-21-2021 at 09:47 AM.
Edgemeal is offline   Reply With Quote
Old 12-03-2020, 03:29 PM   #2301
Supremo
Human being with feelings
 
Join Date: Mar 2019
Posts: 34
Default JS: Legato Control

Hi guys!

I really need your help with the JSFX "Legato Control" in Reaper.

It has a 'Note Hold' feature, which may be assigned to any CC. I'm trying to assign it to CC64 so that whenever I press my sustain pedal the 'Note Hold' function switches ON and once I release the pedal it switches OFF. Pretty straightforward.

However, the JS plugin currently functions in an opposite manner. It turns off the'Note Hold' when the pedal is in a pressed position and triggers it when the pedal is released.

Could anyone come up with the script update that would make it work properly with the sustain pedal?

Here is the original plugin code:
Attached Files
File Type: txt Legato Control.txt (5.2 KB, 183 views)
Supremo is offline   Reply With Quote
Old 12-10-2020, 03:57 PM   #2302
Loulou92
Human being with feelings
 
Loulou92's Avatar
 
Join Date: Sep 2015
Location: Paris
Posts: 544
Default

Hello !
I'd need this little action :

"Unselect items not in any item group"

It would unselect all items that are not part of any item group, while keeping in selection all selected items that are in an item group.

the contrary ("unselect all items that are in an item group") could also work perfectly for what i try to do.

I'll appreciate any help with this !
Loulou92 is offline   Reply With Quote
Old 12-10-2020, 03:58 PM   #2303
tufb
Human being with feelings
 
Join Date: Dec 2017
Posts: 152
Default

Quote:
Originally Posted by Loulou92 View Post
Hello !
I'd need this little action :

"Unselect items not in any item group"

It would unselect all items that are not part of any item group, while keeping in selection all selected items that are in an item group.

the contrary ("unselect all items that are in an item group") could also work perfectly for what i try to do.

I'll appreciate any help with this !
Available now from my personal repo:

bfut_Unselect grouped items
bfut_Unselect ungrouped items


Installation
Directly from https://github.com/bfut/ReaScripts or
Copy and paste this URL in Extensions > ReaPack > Import repositories:
Code:
https://github.com/bfut/ReaScripts/raw/main/index.xml
Then install in Extensions > ReaPack > Browse packages.

Last edited by tufb; 12-10-2020 at 05:38 PM.
tufb is offline   Reply With Quote
Old 12-10-2020, 04:07 PM   #2304
Loulou92
Human being with feelings
 
Loulou92's Avatar
 
Join Date: Sep 2015
Location: Paris
Posts: 544
Default

That was quick ! You had them already done right ? Can't believe you'd script this fast ! Thank you so much.
Loulou92 is offline   Reply With Quote
Old 12-10-2020, 04:17 PM   #2305
tufb
Human being with feelings
 
Join Date: Dec 2017
Posts: 152
Default

Is there any doubt? nah, your posting disappeared then re-appeared... You're welcome!

Are they doing the job for you? I should add them to my repo, in that case.
tufb is offline   Reply With Quote
Old 12-10-2020, 04:34 PM   #2306
Loulou92
Human being with feelings
 
Loulou92's Avatar
 
Join Date: Sep 2015
Location: Paris
Posts: 544
Default

Yes I've just tested them and they work tip top ! One problem solved !!! You could definitely add them to the Reapack. Do you have a Paypal for donations ?

Last edited by Loulou92; 12-10-2020 at 04:42 PM.
Loulou92 is offline   Reply With Quote
Old 12-10-2020, 04:54 PM   #2307
tufb
Human being with feelings
 
Join Date: Dec 2017
Posts: 152
Default

Unfortunately, not at this time. Save it up for another deserving project would be my suggestion, though, perhaps ReaPack's cf. (no affiliation)

edit: Scripts are now available from my personal repo, see sig or my above posting. Cheers.

Last edited by tufb; 12-11-2020 at 08:04 AM.
tufb is offline   Reply With Quote
Old 12-13-2020, 10:12 PM   #2308
Loulou92
Human being with feelings
 
Loulou92's Avatar
 
Join Date: Sep 2015
Location: Paris
Posts: 544
Default

I have a request (another lol) !

"shift track selection up" and "[...] down"

With these two, the track selection would move up or down by one track, leaving the same space between the selected and unselected tracks.

Right now, when you do "select next/previous track", it doesn't act like this, which is kind of normal, but I wish we had this option of moving a complex track selection seemlessly up or down. Would prove super useful here, for simultaneous tasks on several identical folder hierarchies.

Any help appreciated !!
xxxxxx
Loulou92 is offline   Reply With Quote
Old 12-13-2020, 11:58 PM   #2309
Loulou92
Human being with feelings
 
Loulou92's Avatar
 
Join Date: Sep 2015
Location: Paris
Posts: 544
Default

And sorry but I have another request, which is more needed (I have a dirty bug in two of my cycle actions that require this)

Move item content left by time selection lenght
&
Move item content right by time selection lenght

These would shift the media or midi content of the selected items by time selection lenght. If there is already a content offset, it should add or substract the time selection lenght to the offset value.

I know that we have various ways to achive """similar""" things, but I'd really need this one in particular, as it has advantages over actions that rely on the cursor (vanilla Reaper) or the grid (Me2beat script).

I'll consider a small donation as always !

Last edited by Loulou92; 12-14-2020 at 12:30 AM.
Loulou92 is offline   Reply With Quote
Old 12-14-2020, 11:45 AM   #2310
jkooks
Human being with feelings
 
Join Date: May 2020
Posts: 190
Default

Quote:
Originally Posted by Loulou92 View Post
And sorry but I have another request, which is more needed (I have a dirty bug in two of my cycle actions that require this)

Move item content left by time selection lenght
&
Move item content right by time selection lenght

These would shift the media or midi content of the selected items by time selection lenght. If there is already a content offset, it should add or substract the time selection lenght to the offset value.

I know that we have various ways to achive """similar""" things, but I'd really need this one in particular, as it has advantages over actions that rely on the cursor (vanilla Reaper) or the grid (Me2beat script).

I'll consider a small donation as always !


These should work!

Shift Content Right:
Code:
reaper.Undo_BeginBlock()
reaper.PreventUIRefresh(1)

--get new added time
local startTime, endTime = reaper.GetSet_LoopTimeRange(false, false, 0, 0, false)
local totalTime = endTime - startTime

--get item/take
local thisItem = reaper.GetSelectedMediaItem(0, 0)
local thisTake = reaper.GetActiveTake(thisItem)

--adjusts the take offset that is selected by the amount of the time selection
if thisTake then
	local thisOffset = reaper.GetMediaItemTakeInfo_Value(thisTake, "D_STARTOFFS")
	local isLooped = reaper.GetMediaItemInfo_Value(thisItem, "B_LOOPSRC")

	local thisOffset = thisOffset - totalTime

	--if the source is looped you have to adjust the offset differently
	if thisOffset < 0 and isLooped == 1 then
		local source = reaper.GetMediaItemTake_Source(thisTake)
		local sourceLen = reaper.GetMediaSourceLength(source)

		thisOffset = sourceLen + thisOffset
	end

	reaper.SetMediaItemTakeInfo_Value(thisTake, "D_STARTOFFS", thisOffset)

	--makes sure envelope points change with the item
	local envelopeCount = reaper.CountTakeEnvelopes(thisTake)
	for i = 0, envelopeCount - 1 do
		local thisEnvelope = reaper.GetTakeEnvelope(thisTake, i)
		local pointsCount = reaper.CountEnvelopePoints(thisEnvelope)

		for j = pointsCount - 1, 0, -1 do
			local retval, time, value, shape, tension, selected = reaper.GetEnvelopePoint(thisEnvelope, j)
			time = time + totalTime

			reaper.SetEnvelopePoint(thisEnvelope, j, time, value, shape, tension, selected, true)
		end

		reaper.Envelope_SortPoints(thisEnvelope)
	end
end

reaper.PreventUIRefresh(-1)
reaper.UpdateArrange()

reaper.Undo_EndBlock("Shift Item Offset Right", -1)


Shift Content Left:
Code:
reaper.Undo_BeginBlock()
reaper.PreventUIRefresh(1)

--get new added time
local startTime, endTime = reaper.GetSet_LoopTimeRange(false, false, 0, 0, false)
local totalTime = endTime - startTime

--get item/take
local thisItem = reaper.GetSelectedMediaItem(0, 0)
local thisTake = reaper.GetActiveTake(thisItem)

--adjusts the take offset that is selected by the amount of the time selection
if thisTake then
	local thisOffset = reaper.GetMediaItemTakeInfo_Value(thisTake, "D_STARTOFFS")

	local thisOffset = thisOffset + totalTime

	reaper.SetMediaItemTakeInfo_Value(thisTake, "D_STARTOFFS", thisOffset)

	--makes sure envelope points change with the item
	local envelopeCount = reaper.CountTakeEnvelopes(thisTake)
	for i = 0, envelopeCount - 1 do
		local thisEnvelope = reaper.GetTakeEnvelope(thisTake, i)
		local pointsCount = reaper.CountEnvelopePoints(thisEnvelope)

		for j = 0, pointsCount - 1 do
			local retval, time, value, shape, tension, selected = reaper.GetEnvelopePoint(thisEnvelope, j)
			time = time - totalTime

			reaper.SetEnvelopePoint(thisEnvelope, j, time, value, shape, tension, selected, true)
		end

		reaper.Envelope_SortPoints(thisEnvelope)
	end
end

reaper.PreventUIRefresh(-1)
reaper.UpdateArrange()

reaper.Undo_EndBlock("Shift Item Offset Left", -1)
jkooks is offline   Reply With Quote
Old 12-14-2020, 01:14 PM   #2311
jkooks
Human being with feelings
 
Join Date: May 2020
Posts: 190
Default

Quote:
Originally Posted by Loulou92 View Post
I have a request (another lol) !

"shift track selection up" and "[...] down"

With these two, the track selection would move up or down by one track, leaving the same space between the selected and unselected tracks.

Right now, when you do "select next/previous track", it doesn't act like this, which is kind of normal, but I wish we had this option of moving a complex track selection seemlessly up or down. Would prove super useful here, for simultaneous tasks on several identical folder hierarchies.

Any help appreciated !!
xxxxxx
And I think these scripts should handle what you are asking here!

Move tracks up:
Code:
--gets the last track in a folder structure
function GetParentFolderIndex(startIndex)
	local firstTrack

	while true do
		local thisTrack = reaper.GetTrack(0, startIndex)

		if not thisTrack then break end

		local parTrack = reaper.GetParentTrack(thisTrack)

		if not parTrack then
			firstTrack = thisTrack
			break
		else
			startIndex = startIndex - 1
		end
	end

	if firstTrack then startIndex = reaper.GetMediaTrackInfo_Value(firstTrack, "IP_TRACKNUMBER") - 1 end

	return startIndex
end




--move track up
reaper.Undo_BeginBlock()
reaper.PreventUIRefresh(1)

local firstTrack = reaper.GetSelectedTrack(0, 0)
local firstIndex = reaper.GetMediaTrackInfo_Value(firstTrack, "IP_TRACKNUMBER")
local firstDepth = reaper.GetMediaTrackInfo_Value(firstTrack, "I_FOLDERDEPTH")


local moveIndex	= firstIndex - 2
local moveTrack = reaper.GetTrack(0, moveIndex)
local moveDepth = reaper.GetMediaTrackInfo_Value(moveTrack, "I_FOLDERDEPTH")

if moveDepth < 0 and firstDepth == 1 then moveIndex = GetParentFolderIndex(moveIndex) end

reaper.ReorderSelectedTracks(moveIndex, 0)

reaper.PreventUIRefresh(-1)
reaper.UpdateArrange()
reaper.UpdateTimeline()

reaper.Undo_EndBlock("Move Selected Tracks Up", -1)
Move tracks down:
Code:
--gets the last track in a folder structure
function GetLastFolderedTrack(startIndex, isSelect)
	local lastTrack

	while true do
		local thisTrack = reaper.GetTrack(0, startIndex)

		if not thisTrack then break end

		local parTrack = reaper.GetParentTrack(thisTrack)

		if not parTrack then
			break
		else
			lastTrack = thisTrack
			startIndex = startIndex + 1

			if isSelect then reaper.SetTrackSelected(lastTrack, true) end
		end
	end

	if lastTrack then startIndex = reaper.GetMediaTrackInfo_Value(lastTrack, "IP_TRACKNUMBER") end

	return startIndex
end




--move track down
reaper.Undo_BeginBlock()
reaper.PreventUIRefresh(1)

local firstTrack = reaper.GetSelectedTrack(0, 0)
local firstIndex = reaper.GetMediaTrackInfo_Value(firstTrack, "IP_TRACKNUMBER")
local firstDepth = reaper.GetMediaTrackInfo_Value(firstTrack, "I_FOLDERDEPTH")

--grabs the tracks you need to move if they are in a folder
if firstDepth == 1 then firstIndex = GetLastFolderedTrack(firstIndex, true) end



local moveIndex	= firstIndex + 1
local moveTrack = reaper.GetTrack(0, moveIndex - 1)
local moveDepth = reaper.GetMediaTrackInfo_Value(moveTrack, "I_FOLDERDEPTH")

--figures out the end of the tracks if the one you are moving below is a foldered track
if moveDepth == 1 then	moveIndex = GetLastFolderedTrack(moveIndex + 1) end

reaper.ReorderSelectedTracks(moveIndex, 0)

reaper.PreventUIRefresh(-1)
reaper.UpdateArrange()
reaper.UpdateTimeline()

reaper.Undo_EndBlock("Move Selected Tracks Up", -1)
jkooks is offline   Reply With Quote
Old 12-14-2020, 01:23 PM   #2312
Loulou92
Human being with feelings
 
Loulou92's Avatar
 
Join Date: Sep 2015
Location: Paris
Posts: 544
Default

Wow so cool !!!! ok I'm going to test this evening and come back to you asap. In the meantime , a big big thank you Jkooks <3 !!!

Edit : Ok so I've tested the scripts.


Move track up/down : works perfectly !


Shift Content Left & right : very nice, but there is one thing that prevents me from using it in context.
---> Is it be possible for the shift of content to have it affect all selected items ? Right now it affects only one item.

Last edited by Loulou92; 12-14-2020 at 02:44 PM.
Loulou92 is offline   Reply With Quote
Old 12-16-2020, 11:40 AM   #2313
jkooks
Human being with feelings
 
Join Date: May 2020
Posts: 190
Default

Quote:
Originally Posted by Loulou92 View Post
Move track up/down : works perfectly !
Glad it works!

Quote:
Originally Posted by Loulou92 View Post
Shift Content Left & right : Is it be possible for the shift of content to have it affect all selected items?
Yep! Below are the edited scripts so they work with multiple items.

Shift Contents Right:
Code:
reaper.Undo_BeginBlock()
reaper.PreventUIRefresh(1)

--get new added time
local startTime, endTime = reaper.GetSet_LoopTimeRange(false, false, 0, 0, false)
local totalTime = endTime - startTime

local itemNum = reaper.CountSelectedMediaItems(0)

for k = 0, itemNum - 1 do
	--get item/take
	local thisItem = reaper.GetSelectedMediaItem(0, k)
	local thisTake = reaper.GetActiveTake(thisItem)

	--adjusts the take offset that is selected by the amount of the time selection
	if thisTake then
		local thisOffset = reaper.GetMediaItemTakeInfo_Value(thisTake, "D_STARTOFFS")
		local isLooped = reaper.GetMediaItemInfo_Value(thisItem, "B_LOOPSRC")

		local thisOffset = thisOffset - totalTime

		--if the source is looped you have to adjust the offset differently
		if thisOffset < 0 and isLooped == 1 then
			local source = reaper.GetMediaItemTake_Source(thisTake)
			local sourceLen = reaper.GetMediaSourceLength(source)

			thisOffset = sourceLen + thisOffset
		end

		reaper.SetMediaItemTakeInfo_Value(thisTake, "D_STARTOFFS", thisOffset)

		--makes sure envelope points change with the item
		local envelopeCount = reaper.CountTakeEnvelopes(thisTake)
		for i = 0, envelopeCount - 1 do
			local thisEnvelope = reaper.GetTakeEnvelope(thisTake, i)
			local pointsCount = reaper.CountEnvelopePoints(thisEnvelope)

			for j = pointsCount - 1, 0, -1 do
				local retval, time, value, shape, tension, selected = reaper.GetEnvelopePoint(thisEnvelope, j)
				time = time + totalTime

				reaper.SetEnvelopePoint(thisEnvelope, j, time, value, shape, tension, selected, true)
			end

			reaper.Envelope_SortPoints(thisEnvelope)
		end
	end
end

reaper.PreventUIRefresh(-1)
reaper.UpdateArrange()

reaper.Undo_EndBlock("Shift Item Offset Right", -1)


Shift Contents Left:
Code:
reaper.Undo_BeginBlock()
reaper.PreventUIRefresh(1)

--get new added time
local startTime, endTime = reaper.GetSet_LoopTimeRange(false, false, 0, 0, false)
local totalTime = endTime - startTime

local itemNum = reaper.CountSelectedMediaItems(0)

for k = 0, itemNum - 1 do
	--get item/take
	local thisItem = reaper.GetSelectedMediaItem(0, k)
	local thisTake = reaper.GetActiveTake(thisItem)

	--adjusts the take offset that is selected by the amount of the time selection
	if thisTake then
		local thisOffset = reaper.GetMediaItemTakeInfo_Value(thisTake, "D_STARTOFFS")

		local thisOffset = thisOffset + totalTime

		reaper.SetMediaItemTakeInfo_Value(thisTake, "D_STARTOFFS", thisOffset)

		--makes sure envelope points change with the item
		local envelopeCount = reaper.CountTakeEnvelopes(thisTake)
		for i = 0, envelopeCount - 1 do
			local thisEnvelope = reaper.GetTakeEnvelope(thisTake, i)
			local pointsCount = reaper.CountEnvelopePoints(thisEnvelope)

			for j = 0, pointsCount - 1 do
				local retval, time, value, shape, tension, selected = reaper.GetEnvelopePoint(thisEnvelope, j)
				time = time - totalTime

				reaper.SetEnvelopePoint(thisEnvelope, j, time, value, shape, tension, selected, true)
			end

			reaper.Envelope_SortPoints(thisEnvelope)
		end
	end
end

reaper.PreventUIRefresh(-1)
reaper.UpdateArrange()

reaper.Undo_EndBlock("Shift Item Offset Left", -1)
jkooks is offline   Reply With Quote
Old 12-16-2020, 06:37 PM   #2314
ChrisDN
Human being with feelings
 
ChrisDN's Avatar
 
Join Date: Jan 2019
Posts: 81
Default

Hello!

I'd love to have a couple of scripts that I can assign to mouse modifiers for the Track Control Panel.

1) Select all of the sends going to my selected track
2) Select all of the receives from my selected track
Both retaining selection of the selected track.

I'm surprised this doesn't exist already somewhere but I've certainly not been able to find anything. Please point me in the right direction if it does.

Thanks in advance!

Last edited by ChrisDN; 12-16-2020 at 06:52 PM.
ChrisDN is offline   Reply With Quote
Old 12-16-2020, 06:52 PM   #2315
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
Default

I made "Select destination tracks of selected tracks sends recursively" and "Select source tracks of selected tracks receives recursively" that does that. Both are in ReaPack.
cfillion is offline   Reply With Quote
Old 12-16-2020, 07:02 PM   #2316
ChrisDN
Human being with feelings
 
ChrisDN's Avatar
 
Join Date: Jan 2019
Posts: 81
Default

Quote:
Originally Posted by cfillion View Post
I made "Select destination tracks of selected tracks sends recursively" and "Select source tracks of selected tracks receives recursively" that does that. Both are in ReaPack.
I knew it would exist!

That's great, many thanks again.

Edit: I'm running in to an issue with the destination one though and having to terminate the instance. Is there a non-background version, or is this a 'me' error?

Last edited by ChrisDN; 12-16-2020 at 07:49 PM.
ChrisDN is offline   Reply With Quote
Old 12-16-2020, 10:02 PM   #2317
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
Default

Yes, both scripts include a background and a non-background version.

cfillion is offline   Reply With Quote
Old 12-17-2020, 01:07 AM   #2318
Loulou92
Human being with feelings
 
Loulou92's Avatar
 
Join Date: Sep 2015
Location: Paris
Posts: 544
Default

Perfect, jkooks, they are perfect now. Thank you very much !!
Loulou92 is offline   Reply With Quote
Old 12-17-2020, 06:02 AM   #2319
ChrisDN
Human being with feelings
 
ChrisDN's Avatar
 
Join Date: Jan 2019
Posts: 81
Default

Quote:
Originally Posted by cfillion View Post
Yes, both scripts include a background and a non-background version.


Not for me atm. Fully up-to-date SWS + ReaPack with everything by yourself installed according to the package browser.



I'm stumped!


Edit: I'm also seeing this...



Edit 2: I was able to install it by dropping back from v1.2.1 to v1.2
I'm wondering if there's a small typo in the index.xml perhaps?

Last edited by ChrisDN; 12-17-2020 at 06:19 AM.
ChrisDN is offline   Reply With Quote
Old 12-17-2020, 06:50 AM   #2320
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
Default

Quote:
Originally Posted by ChrisDN View Post
Edit 2: I was able to install it by dropping back from v1.2.1 to v1.2
Nice catch, thanks! I've uploaded v1.2.1.1 restoring the missing file (will be available in a few minutes).
cfillion 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 06:47 PM.


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