Old 01-19-2021, 12:31 PM   #241
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,426
Default

Quote:
Originally Posted by ferropop View Post
Also julian, shit dude dunno how I missed this. The ability to skew points (almost like photoshop's Smudge tool) is unreal.
I'm glad you like it!


Quote:
Originally Posted by juliansader View Post
Perhaps the biggest difference between my script ... extra nifty stuff with edge points
In the time since I first posted about my script here, I updated it to automatically add edge points when using Razor selections:




EDIT: I just uploaded a small bug fix v6.32.
juliansader is offline   Reply With Quote
Old 01-19-2021, 01:36 PM   #242
ferropop
Human being with feelings
 
ferropop's Avatar
 
Join Date: Jan 2016
Location: Winnipeg, CANADA
Posts: 1,044
Default

Question about the tilt function (where it tilts the baseline...) is there any way (or plan) to implement something similar to Alt-Drag on a bezier curve to change the tension of the baseline? Does that make sense?

ie, if you had a collection of points that were linear and you tilted them using your tool, you'd get a new linear line...but I imagine being able to pull the "tension" of the tilt into a curve, along with it interpolating the points.

Not a FR lol, I'm happy forever with the script as-is, just curious.
ferropop is online now   Reply With Quote
Old 01-19-2021, 02:15 PM   #243
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,426
Default

The Tilt function cannot do Bézier, but you can adjust the curve with the mousewheel, and toggle between linear and sine with the middle button:

juliansader is offline   Reply With Quote
Old 01-19-2021, 02:32 PM   #244
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Posts: 501
Default

Hi guys,

When RE was introduced, the first thing that came to mind was this script, just uploaded it to my reapack.

If you use regions you're probably familiar with how they strictly split all items that exceed the region (when copied). Unfortunately for me it seems like in all of my projects I have items that start slightly before the beat/region. After copying a region I always have to go and search for these items and manually extend them. (Also there's often tiny item leftovers)

This script basically sets a razor edit to the region under the mouse cursor, but it also has a configurable limit X. If an item exceeds the region by X beats the razor edit will be extended to include that item. (There's also a separate limit by how many beats to shrink the RE to exclude items).



I've been trying to replace the default region ctrl+drag behavior with this, but it really seems impossible. My idea was to somehow use the left-click mouse modifier for regions, but there isn't one? If anyone has some insight/ideas about this, please share.

Last edited by FeedTheCat; 01-19-2021 at 02:50 PM.
FeedTheCat is offline   Reply With Quote
Old 01-19-2021, 04:09 PM   #245
ferropop
Human being with feelings
 
ferropop's Avatar
 
Join Date: Jan 2016
Location: Winnipeg, CANADA
Posts: 1,044
Default

Dude sorry to fawn over this, just.... !!

For the record, I found this script a few hours ago and have since used it literally constantly, all day, and can never go back.

This is the sign of an unreal feature.

Quote:
Originally Posted by juliansader View Post
The Tilt function cannot do Bézier, but you can adjust the curve with the mousewheel, and toggle between linear and sine with the middle button:

ferropop is online now   Reply With Quote
Old 01-19-2021, 04:44 PM   #246
GameAudioRvlzzr
Human being with feelings
 
GameAudioRvlzzr's Avatar
 
Join Date: Apr 2016
Posts: 136
Default

Quote:
Originally Posted by FeedTheCat View Post
in all of my projects I have items that start slightly before the beat/region. After copying a region I always have to go and search for these items and manually extend them. (Also there's often tiny item leftovers)

This script basically sets a razor edit to the region under the mouse cursor
Oh my god, yes! Thank you!
GameAudioRvlzzr is online now   Reply With Quote
Old 01-19-2021, 06:47 PM   #247
WyattRice
Human being with feelings
 
WyattRice's Avatar
 
Join Date: Sep 2009
Location: Virginia
Posts: 2,013
Default

Quote:
Originally Posted by juliansader View Post
I'm glad you like it!




In the time since I first posted about my script here, I updated it to automatically add edge points when using Razor selections:




EDIT: I just uploaded a small bug fix v6.32.
Wow. Is this available for download?
WyattRice is offline   Reply With Quote
Old 01-19-2021, 09:27 PM   #248
cool
Human being with feelings
 
Join Date: Dec 2017
Location: Sunny Siberian Islands
Posts: 414
Default

Quote:
Originally Posted by WyattRice View Post
Wow. Is this available for download?

Yes. This is the "js_Mouse editing - Multi tool" in the ReaPack.
cool is offline   Reply With Quote
Old 01-20-2021, 08:26 AM   #249
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 4,156
Default

Quote:
Originally Posted by FeedTheCat View Post
Hi guys,

When RE was introduced, the first thing that came to mind was this script, just uploaded it to my reapack.
THIS IS BRILLIANT!!!

I just checked it, makes excluding cymbal, timpani and gran cassa so much easier. I would have one suggestion:

if time permits, could you make a version that relies on time selection only?
I personally don't use regions a lot, because, well, the handling is awkward (moving, etc... it's just not right in the current state). So I would much more make use of time selection.

But for now, thanks a lot <3 !!!
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please consider donating to amagalma cfillion FeedTheCat HeDa Julian Sader lb0 nofish Sexan X-Raym
_Stevie_ is online now   Reply With Quote
Old 01-20-2021, 08:33 AM   #250
Klangfarben
Human being with feelings
 
Join Date: Jul 2016
Location: Los Angeles, CA
Posts: 1,282
Default

Quote:
Originally Posted by FeedTheCat View Post
This script basically sets a razor edit to the region under the mouse cursor, but it also has a configurable limit X. If an item exceeds the region by X beats the razor edit will be extended to include that item. (There's also a separate limit by how many beats to shrink the RE to exclude items).
FTC, I can't even tell you how long I've been hoping for something like this! This is fantastic!!

I agree with Stevie, having a version of this without having to explicitly create a region would be great.

Thank you so much!!!
Klangfarben is offline   Reply With Quote
Old 01-20-2021, 09:32 AM   #251
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Posts: 501
Default

Yeah no prob, the time selection variant is online
FeedTheCat is offline   Reply With Quote
Old 01-20-2021, 09:58 AM   #252
gxray
Human being with feelings
 
Join Date: Dec 2020
Location: Miami, FL USA
Posts: 208
Default

@juliansader, @FeedTheCat

I don't have anything of substance to add, I just wanted to say thanks for your scripts here and that they're really cool =)
__________________
Seasoned codemonkey
Dunno a thing about making music (here to learn!)
gxray is online now   Reply With Quote
Old 01-20-2021, 10:17 AM   #253
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 4,156
Default

Quote:
Originally Posted by FeedTheCat View Post
Yeah no prob, the time selection variant is online
Goodness, that was super fast! Thank you!
I just tried it, could it be that it is broken? :O
The RE doesn't exclude certain elments anymore.
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please consider donating to amagalma cfillion FeedTheCat HeDa Julian Sader lb0 nofish Sexan X-Raym
_Stevie_ is online now   Reply With Quote
Old 01-20-2021, 10:53 AM   #254
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 2,134
Default

When seeing this, I instantly think, Reaper needs it's drawing tools for everything, envelope points, waveforms, etc.

I'm not sure, whether I'm ready for Razor Edit XD
__________________
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1385 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper - Donate, if you wish
Meo-Ada Mespotine is offline   Reply With Quote
Old 01-20-2021, 11:48 AM   #255
ferropop
Human being with feelings
 
ferropop's Avatar
 
Join Date: Jan 2016
Location: Winnipeg, CANADA
Posts: 1,044
Default

Is there a way to create a Razor Edit from selected points?

I love the edgepoint behaviour of Razor Edits combined with this script - it's what I've been dreaming of in Reaper for years. It works great for points that are snapped to gridlines because you just create the RE, but in any other case it would be so useful to select some points and have a RE created from them to then use the script on.
ferropop is online now   Reply With Quote
Old 01-20-2021, 04:31 PM   #256
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Posts: 501
Default

Quote:
Originally Posted by _Stevie_ View Post
Goodness, that was super fast! Thank you!
I just tried it, could it be that it is broken? :O
The RE doesn't exclude certain elments anymore.
Hmmm, seems to work here. By default the exclusion is limited to 1 beat, inclusion to 3 beats (there's variables in the script header)
FeedTheCat is offline   Reply With Quote
Old 01-21-2021, 07:13 AM   #257
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 4,156
Default

Hey FTC! Made a quick video to explain the issue:

https://nextcloud.stephanroemer.net/...wgqZaWa5qp5BDz
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please consider donating to amagalma cfillion FeedTheCat HeDa Julian Sader lb0 nofish Sexan X-Raym
_Stevie_ is online now   Reply With Quote
Old 01-21-2021, 08:02 AM   #258
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Posts: 501
Default

Quote:
Originally Posted by _Stevie_ View Post
Hey FTC! Made a quick video to explain the issue:

https://nextcloud.stephanroemer.net/...wgqZaWa5qp5BDz
Nice vid as always For the item in your example to be excluded the RE would have to "shrink" by 2 beats. The variable "shrink_beat_limit" in the script is set to 1, so only items that cross the time selection by 1 beat or less will be excluded. If you don't care to have a limit at all, set both script variables to something ridiculously high.

Edit: As this might confuse other people as well, I set the default limits in both scripts to 3 beats. Which essentially means (cough, time signature) that only items that exceed the region/time selection by less than a measure will be included/excluded.

Last edited by FeedTheCat; 01-21-2021 at 08:26 AM.
FeedTheCat is offline   Reply With Quote
Old 01-22-2021, 05:41 AM   #259
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 4,156
Default

Quote:
Originally Posted by FeedTheCat View Post
Nice vid as always
Thanks!

Quote:
Originally Posted by FeedTheCat View Post
For the item in your example to be excluded the RE would have to "shrink" by 2 beats. The variable "shrink_beat_limit" in the script is set to 1, so only items that cross the time selection by 1 beat or less will be excluded. If you don't care to have a limit at all, set both script variables to something ridiculously high.
Ahh, brilliant, I hadn't seen that setting. Seems to do exactly what I had expected. Thank you!
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please consider donating to amagalma cfillion FeedTheCat HeDa Julian Sader lb0 nofish Sexan X-Raym
_Stevie_ is online now   Reply With Quote
Old 01-22-2021, 05:43 AM   #260
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 4,156
Default

Quote:
Originally Posted by FeedTheCat View Post
... that only items that exceed the region/time selection by less than a measure will be included/excluded.
I think that's the most important info. This only applies to items that *cross* the time selection. Other items that start within the TS will be included.
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please consider donating to amagalma cfillion FeedTheCat HeDa Julian Sader lb0 nofish Sexan X-Raym

Last edited by _Stevie_; 01-22-2021 at 06:06 AM.
_Stevie_ is online now   Reply With Quote
Old 01-24-2021, 02:36 PM   #261
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Posts: 501
Default Razor editing with arrow keys

Hi guys,

I wanted to see if I can find a good workflow for fast razor editing without a mouse.

Today I wrote a few simple scripts that let you move, create and adjust razor edits using the arrow keys and modifiers. So far the workflow looks really promising, but I'll have to use it more in practice to improve/refine the functionality and mappings. I think something like this could have the potential to speed up editing considerably. (The gif is really slow though hehe )



If anyone is interested in giving it a try, here are the hotkeys that I've assigned to the scripts (which are on my reapack). Ideas/suggestions welcome.

FeedTheCat is offline   Reply With Quote
Old 01-24-2021, 04:28 PM   #262
musicbynumbers
Human being with feelings
 
musicbynumbers's Avatar
 
Join Date: Jun 2009
Location: South, UK
Posts: 13,462
Default

Nice work there!

I'll give it a try when I'm next free as it seems really useful thanks!
__________________
subproject FRs click here
note: don't search for my pseudonym on the web. The "musicbynumbers" you find is not me or the name I use for my own music.
musicbynumbers is offline   Reply With Quote
Old 01-31-2021, 12:26 AM   #263
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,426
Default

Quote:
Originally Posted by ferropop View Post
Is there a way to create a Razor Edit from selected points?

I love the edgepoint behaviour of Razor Edits combined with this script - it's what I've been dreaming of in Reaper for years. It works great for points that are snapped to gridlines because you just create the RE, but in any other case it would be so useful to select some points and have a RE created from them to then use the script on.
If a razor selection hasn't been made, the script doesn't add edge points, and only acts on selected points. This was a deliberate decision, since users sometimes don't want or need edge points.

Fortunately, it is easy to add a razor edit at precisely the time span of selected points:
Code:
timeLeft, timeRight = math.huge, -math.huge
env = reaper.GetSelectedEnvelope(0)
if env and reaper.ValidatePtr2(0, env, "TrackEnvelope*") then
    for ai = -1, reaper.CountAutomationItems(env)-1 do
        for p = 0, reaper.CountEnvelopePointsEx(env, ai)-1 do
            pOK, time, _, _, _, selected = reaper.GetEnvelopePointEx(env, ai, p)
            if pOK and time and selected then
                if time < timeLeft then timeLeft = time end
                if time > timeRight then timeRight = time end
            end
        end
    end
    if timeLeft < timeRight then
        track = reaper.Envelope_GetParentTrack(env)
        guidOK, guid = reaper.GetSetEnvelopeInfo_String(env, "GUID", "", false)
        razors = string.format([[ %.20f %.20f "%s"]], timeLeft, timeRight, guid)
        reaper.GetSetMediaTrackInfo_String(track, "P_RAZOREDITS", razors, true)
    end
end
juliansader is offline   Reply With Quote
Old 02-03-2021, 04:55 AM   #264
lalo
Human being with feelings
 
Join Date: Jun 2006
Posts: 157
Default

Hi all!
Great stuff here. Is there any tutorial about Razor selection/edit? I can't find any info on how even do a razor selection/edit.
thanks

edit...ops i see....right mouse button drag and alt...now i have to check how to test all this great scripts...the multi envelope segment edit is a holy grail!

Last edited by lalo; 02-03-2021 at 05:05 AM.
lalo is offline   Reply With Quote
Old 02-03-2021, 08:47 AM   #265
lalo
Human being with feelings
 
Join Date: Jun 2006
Posts: 157
Default

@juliansander really wonderful work! It's a game changer for envelope editing in complex projects.
Do you have any plan to extend this idea to Item Envelopes too? Would be a holy grail for initial gain staging and gain automation on choirs and orchestras
lalo is offline   Reply With Quote
Old 02-03-2021, 10:00 AM   #266
ferropop
Human being with feelings
 
ferropop's Avatar
 
Join Date: Jan 2016
Location: Winnipeg, CANADA
Posts: 1,044
Default

Julian would you consider adding a hotkey for fine adjustments? I find the initial drag to "jump" a bit before settling into smoother adjustment -- holding shift for fine adjustment would make this thing unbelievably perfect.

ps this is in full appreciation for your heroic efforts! just nitpicking something that i'm blown away even exists
ferropop is online now   Reply With Quote
Old 02-03-2021, 10:02 AM   #267
lalo
Human being with feelings
 
Join Date: Jun 2006
Posts: 157
Default

Quote:
Originally Posted by Sexan View Post
Adjusting fades on right click drag, edge limiting and etc
That's a very useful gesture! Where can i find a version to test?
thanks
lalo is offline   Reply With Quote
Old 02-03-2021, 10:34 AM   #268
ferropop
Human being with feelings
 
ferropop's Avatar
 
Join Date: Jan 2016
Location: Winnipeg, CANADA
Posts: 1,044
Default

Quote:
Originally Posted by ferropop View Post
Julian would you consider adding a hotkey for fine adjustments? I find the initial drag to "jump" a bit before settling into smoother adjustment -- holding shift for fine adjustment would make this thing unbelievably perfect.

ps this is in full appreciation for your heroic efforts! just nitpicking something that i'm blown away even exists
A practical (and critical) use-case is with editing MPE data.

Usually PitchBend is set to 48 semitones (HUGE!) so trying to pull in a slightly sharp/flat note in the pitchbend lane is literally impossible. If the full height of the lane is 48 semitones, you can imagine a single note being slightly sharp/flat is a fraction of a pixel adjustment.

Fine adjustment in this case is not only desirable but essential. Your script could go a long way in giving us proper MPE editing!
ferropop is online now   Reply With Quote
Old 02-03-2021, 01:46 PM   #269
musicbynumbers
Human being with feelings
 
musicbynumbers's Avatar
 
Join Date: Jun 2009
Location: South, UK
Posts: 13,462
Default Razor Script idea :) (copying children items to all identically named parent items)

Hi all!

Hoping the below idea might be possible and not too hard to do?

We don't have proper folders in Reaper so this is one way of getting the advantages of subprojects but without some of subprojects downfalls

It's basically copying children items to all identically named parent items by using a named midi item on the parent track.

You would then use this new script to copy the child items beneath the folder track item to below all identically named parent track items.

reason to want this? So that if we have a repeating pattern throughout the track (like a drumbeat) then we can set it up like below image has it and make edits to just one of the child items, use the script and these edits get copied to all the other "folders"



So in first image "1" is where we are editing


Then using the script, it copies items added to 1, to below the parent item of both 2 and 3 (since the name is the same)


We then make edits to 1 (making it different to 2 and 3)


using the script again, we end up with the edits in 1 being copied to 2 and 3 (since the name was the same) and it overwrites everything in the child item so that they are identical.




Some things to bear in mind.

-The script needs you to select the item for which you want the child items to be copied to all the same named parent items.

-Ideally the parent item should be an actual reaper folder track with the child items actually nested/routed to this parent folder track.

-It needs to be destructive the child items need to overwrite everything on all other tracks (something razor cut and paste does anyway if set that way).

-It needs to ignore items named slightly differently but on the same track as you might have a verse drum edit and a chorus drum edit (as an example)

-It should be that you can edit any of the children of any "parent item" and then use the script to copy it over to all others with same name



This code might get close to it too. It's a script Embass made which selects all child items below the parent one

Code:
-- Author: Embass
-- v0.1

-- enable this option if you want to select automation too.. 
-- Options: Move envelope points with media items and razor edits

local media_items_count = reaper.CountSelectedMediaItems(0)
if media_items_count ~= 1 then  
	local mouse_x, mouse_y = reaper.GetMousePosition()
	reaper.TrackCtl_SetToolTip("Select 1 media item", mouse_x + 15, mouse_y, true)
	return -- terminate script
end

local media_item = reaper.GetSelectedMediaItem(0, 0)
if media_item == nil then return end -- terminate script

local track = reaper.GetMediaItem_Track(media_item)
if track == nil then return end -- terminate script

local media_item_start = reaper.GetMediaItemInfo_Value(media_item, "D_POSITION")
local media_item_len = reaper.GetMediaItemInfo_Value(media_item, "D_LENGTH")
local media_item_end = media_item_start + media_item_len

if media_item_len == 0 then return end -- terminate script

function get_folder_tracks(folder_track) --> folder_tracks
	local all_tracks = {}
	table.insert(all_tracks, folder_track)
	if reaper.GetMediaTrackInfo_Value(folder_track, "I_FOLDERDEPTH") ~= 1 then
		return all_tracks -- exit, track not a folder
	end
	local tracks_count = reaper.CountTracks(0)
	local folder_track_depth = reaper.GetTrackDepth(folder_track)     
	local track_index = reaper.GetMediaTrackInfo_Value(folder_track, "IP_TRACKNUMBER")
	for i = track_index, tracks_count - 1 do
		local track = reaper.GetTrack(0, i)
		local track_depth = reaper.GetTrackDepth(track)
		if track_depth > folder_track_depth then               
			table.insert(all_tracks, track)
		else
			break -- exit loop
		end
	end
	return all_tracks
end

local folder_tracks = get_folder_tracks(track)

reaper.PreventUIRefresh(1)
reaper.Undo_BeginBlock()

	reaper.Main_OnCommand(42406, 0) -- Razor edit: Clear all areas
	local str_area = string.format([[%s %s '']], media_item_start, media_item_end)
	for i, track in ipairs(folder_tracks) do
		reaper.GetSetMediaTrackInfo_String(track, "P_RAZOREDITS", str_area, true)     
	end

reaper.Undo_EndBlock("Set area selection", -1)
reaper.PreventUIRefresh(-1)
reaper.UpdateArrange()
__________________
subproject FRs click here
note: don't search for my pseudonym on the web. The "musicbynumbers" you find is not me or the name I use for my own music.

Last edited by musicbynumbers; 02-03-2021 at 01:51 PM.
musicbynumbers is offline   Reply With Quote
Old 02-04-2021, 10:06 AM   #270
Embass
Human being with feelings
 
Embass's Avatar
 
Join Date: Jan 2014
Posts: 519
Default



Code:
-- copy children items to all identically named parent items
-- author: embass
-- v0.1
local mouse_x, mouse_y = reaper.GetMousePosition()
local media_item_count = reaper.CountSelectedMediaItems(0);
if media_item_count ~= 1 then  
	reaper.TrackCtl_SetToolTip("Select 1 media item", mouse_x + 15, mouse_y, true)
	return -- terminate script
end
local media_item = reaper.GetSelectedMediaItem(0, 0); if media_item == nil then return end -- terminate script
local media_item_len = reaper.GetMediaItemInfo_Value(media_item, "D_LENGTH"); if media_item_len == 0 then return end -- terminate script
local media_item_start = reaper.GetMediaItemInfo_Value(media_item, "D_POSITION")
local media_item_end = media_item_start + media_item_len
local track = reaper.GetMediaItem_Track(media_item); if track == nil then return end -- terminate script
if reaper.GetMediaTrackInfo_Value(track, "I_FOLDERDEPTH") ~= 1 then 
	reaper.TrackCtl_SetToolTip("Select item on parent track", mouse_x + 15, mouse_y, true)
	return -- terminate script 
end
local track_count = reaper.CountTracks(0)
if track_count == reaper.GetMediaTrackInfo_Value(track, "IP_TRACKNUMBER") then return end -- terminate script, item on last track
local take = reaper.GetActiveTake(media_item); if take == nil then return end -- terminate script
local take_name = reaper.GetTakeName(take); if take_name == nil then return end -- terminate script
local media_items = {} -- media items with the same name
for i = 0, reaper.CountTrackMediaItems(track) - 1 do
	local media_item = reaper.GetTrackMediaItem(track, i)
	if reaper.GetMediaItemInfo_Value(media_item, "D_LENGTH") > 0 then
		local take = reaper.GetActiveTake(media_item)
		if take ~= nil then
			if take_name == reaper.GetTakeName(take) then
				table.insert(media_items, media_item)
			end
		end
	end
end
if #media_items < 2 then return end -- terminate script
function get_children_tracks(parent_track) --> children tracks
	local children_tracks = {}
	local track_count = reaper.CountTracks(0)
	local parent_track_depth = reaper.GetTrackDepth(parent_track)     
	local track_index = reaper.GetMediaTrackInfo_Value(parent_track, "IP_TRACKNUMBER") -- next track index
	for i = track_index, track_count - 1 do
		local track = reaper.GetTrack(0, i)
		local track_depth = reaper.GetTrackDepth(track)
		if track_depth > parent_track_depth then table.insert(children_tracks, track)
		else break -- exit loop
		end
	end
	return children_tracks
end
local children_tracks = get_children_tracks(track); if #children_tracks == 0 then return end -- terminate script
local track1 = children_tracks[1] -- first child
local edit_cursor_pos = reaper.GetCursorPosition() -- save
local trim_state = reaper.GetToggleCommandState(42421) -- Options: Always trim content behind razor edits
reaper.PreventUIRefresh(1)
reaper.Undo_BeginBlock()
	reaper.Main_OnCommand(40309, 0) -- Set ripple editing off
	if trim_state == 0 then reaper.Main_OnCommand(42421, 0); restore_trim = true end -- set trim content behind area
	local hidden_tracks = {} -- save
	for i, track in ipairs(children_tracks) do
		if not reaper.IsTrackVisible(track, false) then
			hidden_tracks[track] = true
			reaper.SetMediaTrackInfo_Value(track, "B_SHOWINTCP", 1) -- make visible
		end 
	end
	reaper.Main_OnCommand(42406, 0) -- Razor edit: Clear all areas
	reaper.SelectAllMediaItems(0, false) -- unselect all items
	local str_track_razor_edits = string.format([[%s %s '']], media_item_start, media_item_end)
	for i, track in ipairs(children_tracks) do
		reaper.GetSetMediaTrackInfo_String(track, "P_RAZOREDITS", str_track_razor_edits, true) -- set
	end
	reaper.Main_OnCommand(40060, 0) -- Item: Copy selected area of items
	reaper.SetOnlyTrackSelected(track1) -- set last touched track
	for i, item in ipairs(media_items) do
		if item ~= media_item then
			local item_start = reaper.GetMediaItemInfo_Value(item, "D_POSITION")
			reaper.SetEditCurPos(item_start, false, false)
			reaper.Main_OnCommand(42398, 0) --Item: Paste items/tracks
		end
	end
	reaper.Main_OnCommand(42406, 0) -- Razor edit: Clear all areas
	reaper.SelectAllMediaItems(0, false) -- unselect all items
	reaper.SetEditCurPos(edit_cursor_pos, false, false) -- restore
	for track in pairs(hidden_tracks) do
		reaper.SetMediaTrackInfo_Value(track, "B_SHOWINTCP", 0) -- hide
	end
	reaper.SetOnlyTrackSelected(track) -- parent track
	reaper.SetMediaItemSelected(media_item, true) -- restore media item selection
	if restore_trim then reaper.Main_OnCommand(42421, 0) end -- restore
reaper.Undo_EndBlock("Copy items", -1)
reaper.PreventUIRefresh(-1)
reaper.UpdateArrange()
Embass is offline   Reply With Quote
Old 02-04-2021, 10:24 AM   #271
musicbynumbers
Human being with feelings
 
musicbynumbers's Avatar
 
Join Date: Jun 2009
Location: South, UK
Posts: 13,462
Default

Embass to the rescue again!

Thanks for this! Just out for a while but will try it when back.

Do you have a patreon or something I can donate too to say thanks?
__________________
subproject FRs click here
note: don't search for my pseudonym on the web. The "musicbynumbers" you find is not me or the name I use for my own music.
musicbynumbers is offline   Reply With Quote
Old 02-04-2021, 11:22 AM   #272
rasmusmarshagen
Human being with feelings
 
Join Date: May 2020
Posts: 53
Default Theme

Quote:
Originally Posted by Embass View Post


Code:
-- copy children items to all identically named parent items
-- author: embass
-- v0.1
local mouse_x, mouse_y = reaper.GetMousePosition()
local media_item_count = reaper.CountSelectedMediaItems(0);
if media_item_count ~= 1 then  
	reaper.TrackCtl_SetToolTip("Select 1 media item", mouse_x + 15, mouse_y, true)
	return -- terminate script
end
local media_item = reaper.GetSelectedMediaItem(0, 0); if media_item == nil then return end -- terminate script
local media_item_len = reaper.GetMediaItemInfo_Value(media_item, "D_LENGTH"); if media_item_len == 0 then return end -- terminate script
local media_item_start = reaper.GetMediaItemInfo_Value(media_item, "D_POSITION")
local media_item_end = media_item_start + media_item_len
local track = reaper.GetMediaItem_Track(media_item); if track == nil then return end -- terminate script
if reaper.GetMediaTrackInfo_Value(track, "I_FOLDERDEPTH") ~= 1 then 
	reaper.TrackCtl_SetToolTip("Select item on parent track", mouse_x + 15, mouse_y, true)
	return -- terminate script 
end
local track_count = reaper.CountTracks(0)
if track_count == reaper.GetMediaTrackInfo_Value(track, "IP_TRACKNUMBER") then return end -- terminate script, item on last track
local take = reaper.GetActiveTake(media_item); if take == nil then return end -- terminate script
local take_name = reaper.GetTakeName(take); if take_name == nil then return end -- terminate script
local media_items = {} -- media items with the same name
for i = 0, reaper.CountTrackMediaItems(track) - 1 do
	local media_item = reaper.GetTrackMediaItem(track, i)
	if reaper.GetMediaItemInfo_Value(media_item, "D_LENGTH") > 0 then
		local take = reaper.GetActiveTake(media_item)
		if take ~= nil then
			if take_name == reaper.GetTakeName(take) then
				table.insert(media_items, media_item)
			end
		end
	end
end
if #media_items < 2 then return end -- terminate script
function get_children_tracks(parent_track) --> children tracks
	local children_tracks = {}
	local track_count = reaper.CountTracks(0)
	local parent_track_depth = reaper.GetTrackDepth(parent_track)     
	local track_index = reaper.GetMediaTrackInfo_Value(parent_track, "IP_TRACKNUMBER") -- next track index
	for i = track_index, track_count - 1 do
		local track = reaper.GetTrack(0, i)
		local track_depth = reaper.GetTrackDepth(track)
		if track_depth > parent_track_depth then table.insert(children_tracks, track)
		else break -- exit loop
		end
	end
	return children_tracks
end
local children_tracks = get_children_tracks(track); if #children_tracks == 0 then return end -- terminate script
local track1 = children_tracks[1] -- first child
local edit_cursor_pos = reaper.GetCursorPosition() -- save
local trim_state = reaper.GetToggleCommandState(42421) -- Options: Always trim content behind razor edits
reaper.PreventUIRefresh(1)
reaper.Undo_BeginBlock()
	reaper.Main_OnCommand(40309, 0) -- Set ripple editing off
	if trim_state == 0 then reaper.Main_OnCommand(42421, 0); restore_trim = true end -- set trim content behind area
	local hidden_tracks = {} -- save
	for i, track in ipairs(children_tracks) do
		if not reaper.IsTrackVisible(track, false) then
			hidden_tracks[track] = true
			reaper.SetMediaTrackInfo_Value(track, "B_SHOWINTCP", 1) -- make visible
		end 
	end
	reaper.Main_OnCommand(42406, 0) -- Razor edit: Clear all areas
	reaper.SelectAllMediaItems(0, false) -- unselect all items
	local str_track_razor_edits = string.format([[%s %s '']], media_item_start, media_item_end)
	for i, track in ipairs(children_tracks) do
		reaper.GetSetMediaTrackInfo_String(track, "P_RAZOREDITS", str_track_razor_edits, true) -- set
	end
	reaper.Main_OnCommand(40060, 0) -- Item: Copy selected area of items
	reaper.SetOnlyTrackSelected(track1) -- set last touched track
	for i, item in ipairs(media_items) do
		if item ~= media_item then
			local item_start = reaper.GetMediaItemInfo_Value(item, "D_POSITION")
			reaper.SetEditCurPos(item_start, false, false)
			reaper.Main_OnCommand(42398, 0) --Item: Paste items/tracks
		end
	end
	reaper.Main_OnCommand(42406, 0) -- Razor edit: Clear all areas
	reaper.SelectAllMediaItems(0, false) -- unselect all items
	reaper.SetEditCurPos(edit_cursor_pos, false, false) -- restore
	for track in pairs(hidden_tracks) do
		reaper.SetMediaTrackInfo_Value(track, "B_SHOWINTCP", 0) -- hide
	end
	reaper.SetOnlyTrackSelected(track) -- parent track
	reaper.SetMediaItemSelected(media_item, true) -- restore media item selection
	if restore_trim then reaper.Main_OnCommand(42421, 0) end -- restore
reaper.Undo_EndBlock("Copy items", -1)
reaper.PreventUIRefresh(-1)
reaper.UpdateArrange()
What gorgeous looking theme is that if I may ask?
rasmusmarshagen is offline   Reply With Quote
Old 02-04-2021, 05:19 PM   #273
musicbynumbers
Human being with feelings
 
musicbynumbers's Avatar
 
Join Date: Jun 2009
Location: South, UK
Posts: 13,462
Default

Embass

So far it's been quite resilient in testing and is going to be a super useful script thanks!

Maybe it's too "perverted" to ask something so twisted but do you reckon it would be hard to take into account if the parent midi item was not at it's normal rate and had been time stretched (or changed by a tempo change)?

So if one of the parent items we wanted to copy to was at 200% stretch and one was at 50% stretch. Do you know if there's a way to make that work?

No worries if not though. Already this is going to help me a lot!
__________________
subproject FRs click here
note: don't search for my pseudonym on the web. The "musicbynumbers" you find is not me or the name I use for my own music.
musicbynumbers is offline   Reply With Quote
Old 02-05-2021, 09:41 AM   #274
Embass
Human being with feelings
 
Embass's Avatar
 
Join Date: Jan 2014
Posts: 519
Default

Quote:
Originally Posted by musicbynumbers View Post
Maybe it's too "perverted" to ask something so twisted but do you reckon it would be hard to take into account if the parent midi item was not at it's normal rate and had been time stretched (or changed by a tempo change)?
shouldn't be too hard. i will take a look at it..

Quote:
Originally Posted by musicbynumbers View Post
Do you lovely scripting gods know if it's possible to have a script that allows you to do a razor style timestretch but for it to only adjust the start positions of the items and to leave the item length alone?
try scripts 2, 4, 6

scripts:
1. Area selection - Stretch right edge to edit cursor
2. Area selection - Stretch right edge to edit cursor (preserve item playrate, length)
3. Area selection - Stretch left edge to edit cursor
4. Area selection - Stretch left edge to edit cursor (preserve item playrate, length)
5. Area selection - Move and stretch to fit time selection
6. Area selection - Move and stretch to fit time selection (preserve item playrate, length)

Download: https://drive.google.com/file/d/1iVc...ew?usp=sharing



Quote:
Originally Posted by rasmusmarshagen View Post
What gorgeous looking theme is that if I may ask?
Theme: Instrument 5
https://stash.reaper.fm/theme/2633/I...ReaperThemeZip
Embass is offline   Reply With Quote
Old 02-05-2021, 10:59 AM   #275
rasmusmarshagen
Human being with feelings
 
Join Date: May 2020
Posts: 53
Default

Quote:
Originally Posted by Embass View Post
Thanks!!
rasmusmarshagen is offline   Reply With Quote
Old 02-05-2021, 11:10 AM   #276
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 7,219
Default

@embass
I think it is time for you to have your github repo for reapack sharing and to let us keep track of all your great scripts :P


Of at least upload them on ReaTeam repo with the reapack.com uploader !
X-Raym is offline   Reply With Quote
Old 02-05-2021, 11:22 AM   #277
musicbynumbers
Human being with feelings
 
musicbynumbers's Avatar
 
Join Date: Jun 2009
Location: South, UK
Posts: 13,462
Default

Thanks Embass!

I'll try those scripts too.
__________________
subproject FRs click here
note: don't search for my pseudonym on the web. The "musicbynumbers" you find is not me or the name I use for my own music.
musicbynumbers is offline   Reply With Quote
Old 02-07-2021, 12:46 AM   #278
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 882
Default

Quote:
Originally Posted by X-Raym View Post
@embass
I think it is time for you to have your github repo for reapack sharing and to let us keep track of all your great scripts :P


Of at least upload them on ReaTeam repo with the reapack.com uploader !
second that, have used some great scripts from embass! hahaha
daniellumertz is online now   Reply With Quote
Old 02-07-2021, 03:38 AM   #279
musicbynumbers
Human being with feelings
 
musicbynumbers's Avatar
 
Join Date: Jun 2009
Location: South, UK
Posts: 13,462
Default

Quote:
Originally Posted by daniellumertz View Post
second that, have used some great scripts from embass! hahaha
Agreed too!

Embass scripts have made my life massively easier!
__________________
subproject FRs click here
note: don't search for my pseudonym on the web. The "musicbynumbers" you find is not me or the name I use for my own music.
musicbynumbers is offline   Reply With Quote
Old 02-07-2021, 01:37 PM   #280
Vagelis
Human being with feelings
 
Vagelis's Avatar
 
Join Date: Oct 2017
Location: Larisa, Greece
Posts: 1,096
Default

@Embass you nailed it once again, some of the most useful scripts for RE, thank you very much
Vagelis 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:21 PM.


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