 |
|
|
10-25-2022, 03:43 AM
|
#1
|
Human being with feelings
Join Date: Nov 2010
Posts: 1,485
|
After recording MIDI, expand / trim media item beginning and end to nearest bar
As the title suggests, I think it would be helpful if, after recording midi, the media item start and end were expanded (trimmed?) to the nearest bar on the grid.
This currently happens with retrospective record so I think it would be consistent for it to happen in normal record.
It would be a great timesaver when wanting to loop newly recorded midi items, IMHO, as I spend a lot of my time, post recording, triggering an action to expand the item.
If this isn't useful to some, then maybe an option?
Edit: Having thought about my discourse with Vitalker below, I now think "trim" is also relevant for both start and end of the item. Say you start recording before bar 3 but you don't actually play a note till the 2nd beat of bar 3. For me, the beginning of the item should be "trimmed" to the start of bar 3, not expanded to the beginning of bar 2. Same with the end ; You finish playing before the end of bar 3 but continue recording over the beginning of bar 4. I would want the item to be trimmed to the end of bar 3 rather than expanded to the end of bar 4.
Last edited by mozart999uk; 11-14-2022 at 09:04 AM.
Reason: thought of something else
|
|
|
10-25-2022, 03:56 AM
|
#2
|
Human being with feelings
Join Date: Dec 2012
Posts: 12,800
|
I support, but not trimming, just expanding to nearest, so no data is lost.
|
|
|
10-25-2022, 04:03 AM
|
#3
|
Human being with feelings
Join Date: Nov 2010
Posts: 1,485
|
Quote:
Originally Posted by vitalker
I support, but not trimming, just expanding to nearest, so no data is lost. 
|
Yes indeed. Expanding is the better word 👍
Actually see above. I think "trim" as also relevant here not just "expand". Data will not be lost in the scenario I mention above.
Last edited by mozart999uk; 03-19-2023 at 10:46 AM.
Reason: thought of something else
|
|
|
10-25-2022, 04:18 AM
|
#4
|
Human being with feelings
Join Date: Dec 2012
Posts: 12,800
|
Quote:
Originally Posted by mozart999uk
Yes indeed. Expanding is the better word 👍
|
Maybe rename the thread then.
|
|
|
10-25-2022, 04:23 AM
|
#5
|
Human being with feelings
Join Date: Nov 2010
Posts: 1,485
|
Quote:
Originally Posted by vitalker
Maybe rename the thread then. 
|
OK. I wasn't going to as then it would make your comment look pointless. But I will.
|
|
|
10-25-2022, 04:23 AM
|
#6
|
Human being with feelings
Join Date: Jan 2011
Posts: 804
|
+1!
|
|
|
10-28-2022, 03:12 PM
|
#7
|
Human being with feelings
Join Date: Mar 2022
Posts: 1,522
|
+1
|
|
|
11-05-2022, 07:57 AM
|
#8
|
Human being with feelings
Join Date: Mar 2017
Location: Tokyo
Posts: 63
|
+1
|
|
|
11-07-2022, 06:53 AM
|
#9
|
Human being with feelings
Join Date: Oct 2016
Posts: 99
|
+1
|
|
|
11-07-2022, 02:32 PM
|
#10
|
Human being with feelings
Join Date: Sep 2021
Location: Berlin
Posts: 1,432
|
This script will do the expansion of selected MIDI items -- I know that's not exactly what you want, but it's a "today" option, as opposed to a "possibly never" solution.
Let me know how it works for you...
Code:
-- sockmonkey72_ExtendMIDIItemToNearestBars.lua
local reaper = reaper
reaper.Undo_BeginBlock2(0)
local selectedItems = reaper.CountSelectedMediaItems(0)
for i = 0, selectedItems - 1 do
local item = reaper.GetSelectedMediaItem(0, i)
take = reaper.GetActiveTake(item)
if take and reaper.TakeIsMIDI(take) then
local pos = reaper.GetMediaItemInfo_Value(item, "D_POSITION")
local len = reaper.GetMediaItemInfo_Value(item, "D_LENGTH")
local _, startMeasures = reaper.TimeMap2_timeToBeats(0, pos)
local endBeats, endMeasures, endCml = reaper.TimeMap2_timeToBeats(0, pos + len)
if endBeats < 0.00001 then
endCml = 0
end
local startOfMeasure = reaper.TimeMap2_beatsToTime(0, 0, startMeasures)
local endOfMeasure = reaper.TimeMap2_beatsToTime(0, endCml, endMeasures)
reaper.MIDI_SetItemExtents(item, reaper.TimeMap2_timeToQN(0, startOfMeasure), reaper.TimeMap2_timeToQN(0, endOfMeasure))
reaper.MarkTrackItemsDirty(reaper.GetMediaItem_Track(item), item)
end
end
reaper.Undo_EndBlock2(0, "Resize MIDI Item(s)", -1)
Last edited by sockmonkey72; 11-08-2022 at 08:12 AM.
|
|
|
11-08-2022, 04:32 AM
|
#11
|
Human being with feelings
Join Date: Nov 2010
Posts: 1,485
|
Hey thanks for that Sockmonkey.
As an interim fix, that works really well. 👍
I was using the me2beats script (trim sel items edge to nearest measure start) but I needed an expand rather than a trim,
Let's hope the devs see this thread and come up with a automatic solution :-)
|
|
|
11-08-2022, 08:13 AM
|
#12
|
Human being with feelings
Join Date: Sep 2021
Location: Berlin
Posts: 1,432
|
Quote:
Originally Posted by mozart999uk
Hey thanks for that Sockmonkey.
As an interim fix, that works really well. 👍
I was using the me2beats script (trim sel items edge to nearest measure start) but I needed an expand rather than a trim,
Let's hope the devs see this thread and come up with a automatic solution :-)
|
Thanks for letting me know. I've added the script to my ReaPack repos, in case it's more comfortable to grab from there.
|
|
|
11-08-2022, 08:34 AM
|
#13
|
Human being with feelings
Join Date: Nov 2010
Posts: 1,485
|
Excellent!
|
|
|
11-08-2022, 09:30 AM
|
#14
|
Human being with feelings
Join Date: Dec 2020
Posts: 38
|
+1
|
|
|
11-14-2022, 02:52 PM
|
#15
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 4,880
|
Appreciate the script as well @sock.
But then again, some functionality should work as it should without trying to fix it with scripts. I already got so many fix-scripts running to adjust REAPERs behavior, it's not even funny anymore.
|
|
|
12-21-2022, 01:19 AM
|
#17
|
Human being with feelings
Join Date: Sep 2022
Posts: 6
|
+1
|
|
|
02-19-2023, 03:55 PM
|
#18
|
Human being with feelings
Join Date: Mar 2017
Location: Ukraine, Kyiv
Posts: 531
|
Quote:
Originally Posted by sockmonkey72
This script will do the expansion of selected MIDI items -- I know that's not exactly what you want, but it's a "today" option, as opposed to a "possibly never" solution.
Let me know how it works for you...
Code:
-- sockmonkey72_ExtendMIDIItemToNearestBars.lua
local reaper = reaper
reaper.Undo_BeginBlock2(0)
local selectedItems = reaper.CountSelectedMediaItems(0)
for i = 0, selectedItems - 1 do
local item = reaper.GetSelectedMediaItem(0, i)
take = reaper.GetActiveTake(item)
if take and reaper.TakeIsMIDI(take) then
local pos = reaper.GetMediaItemInfo_Value(item, "D_POSITION")
local len = reaper.GetMediaItemInfo_Value(item, "D_LENGTH")
local _, startMeasures = reaper.TimeMap2_timeToBeats(0, pos)
local endBeats, endMeasures, endCml = reaper.TimeMap2_timeToBeats(0, pos + len)
if endBeats < 0.00001 then
endCml = 0
end
local startOfMeasure = reaper.TimeMap2_beatsToTime(0, 0, startMeasures)
local endOfMeasure = reaper.TimeMap2_beatsToTime(0, endCml, endMeasures)
reaper.MIDI_SetItemExtents(item, reaper.TimeMap2_timeToQN(0, startOfMeasure), reaper.TimeMap2_timeToQN(0, endOfMeasure))
reaper.MarkTrackItemsDirty(reaper.GetMediaItem_Track(item), item)
end
end
reaper.Undo_EndBlock2(0, "Resize MIDI Item(s)", -1)
|
is there any progress on this to make it work natively?
|
|
|
03-18-2023, 07:58 PM
|
#19
|
Human being with feelings
Join Date: Jan 2022
Posts: 61
|
Thanks sockmonkey. Does anyone happen to have a script to use this function on midi items from arrangement view, without having to go into the midi window?
|
|
|
03-19-2023, 05:34 AM
|
#20
|
Human being with feelings
Join Date: Sep 2021
Location: Berlin
Posts: 1,432
|
Quote:
Originally Posted by jonnyjupiter
Thanks sockmonkey. Does anyone happen to have a script to use this function on midi items from arrangement view, without having to go into the midi window?
|
That script should work fine from the arrangement view, it doesn't rely on the MIDI Editor at all. You just need to select the items you want modified.
|
|
|
03-19-2023, 10:47 AM
|
#21
|
Human being with feelings
Join Date: Nov 2010
Posts: 1,485
|
Just bumping this as I think it should work this way natively :-)
|
|
|
03-19-2023, 10:47 AM
|
#22
|
Human being with feelings
Join Date: Nov 2010
Posts: 1,485
|
Quote:
Originally Posted by Skorobagatko
is there any progress on this to make it work natively?
|
Not yet but I'm hoping it will attract the attention of the devs soon :-)
|
|
|
03-19-2023, 10:48 AM
|
#23
|
Human being with feelings
Join Date: Nov 2010
Posts: 1,485
|
Quote:
Originally Posted by _Stevie_
Appreciate the script as well @sock.
But then again, some functionality should work as it should without trying to fix it with scripts. I already got so many fix-scripts running to adjust REAPERs behavior, it's not even funny anymore.
|
Agreed 100% :-)
|
|
|
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 09:00 PM.
|