Old 06-26-2020, 11:33 AM   #1
daxliniere
Human being with feelings
 
daxliniere's Avatar
 
Join Date: Nov 2008
Location: London, UK
Posts: 2,024
Default Is there a 'close gaps' script?

I figure there must be a script that does this and I'm just guessing the right words to find it.

The function I'm looking for will move (later) items backwards to close gaps between items. The function is very common in video editing software.

Any thoughts?
__________________
Dax Liniere
London's newest premium studio complex! (Facebook)
[i7-4790K, 12Gb RAM, Win8.1x64, NVidia GT710, UAD2-OCTO, FireFaceUFX, REAPER x64]
daxliniere is offline   Reply With Quote
Old 06-26-2020, 11:43 AM   #2
solger
Human being with feelings
 
solger's Avatar
 
Join Date: Mar 2013
Posts: 4,638
Default

Maybe have a look at the Time selection: Remove contents of time selection (moving later items) Action.
Or at Archie's Remove contents of time selection in selected tracks (moving later items) script (available via ReaPack).

Can't remember if there might also be an option in combination with Ripple Editing.
__________________
ReaLauncher

Last edited by solger; 06-26-2020 at 11:50 AM.
solger is offline   Reply With Quote
Old 06-26-2020, 02:56 PM   #3
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,729
Default

Also, in SWS:
Xenakios/SWS: Reposition selected items

Add time interval to item: Item end, Time intervall: 0 seconds
nofish is offline   Reply With Quote
Old 06-26-2020, 03:26 PM   #4
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 658
Default

I have a function in my Ultraschall-Api which returns the gaps between items on a track-basis.
This would allow getting rid of the gaps.

As you probably want to have only removal of gaps in specific tracks and from a certain start to end position, I could write you a script which does:

Remove all gaps between items in selected tracks within timeselection, if you want.

And if yes, should it ripple move only the items within the timeselection or shall it ripple all following items on the track?
__________________
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1200 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper - Donate, if you wish
Meo-Ada Mespotine is offline   Reply With Quote
Old 06-26-2020, 03:33 PM   #5
andyp24
Human being with feelings
 
Join Date: Mar 2016
Posts: 770
Default

I wrote a script which closes the gap between items.

It's reasonably intelligent in the way it moves things if you have items on multiple tracks selected, and it will attempt to preserve crossfades (ie it positions the start of the item it moves at the start of the fade out of the item to its left, so as to crossfade between them if you have a similar fade in/out length.

Let me know if you want to try it.

Andy
andyp24 is offline   Reply With Quote
Old 06-26-2020, 04:13 PM   #6
daxliniere
Human being with feelings
 
daxliniere's Avatar
 
Join Date: Nov 2008
Location: London, UK
Posts: 2,024
Default

Hey everyone, thanks for rushing to help! (Damn, this is what I love about the REAPER community. )

@Andyp24, thank you, that would be wonderful. The items all have fades, but no crossfades. Each item (voice snippets) is an individual thing.

Feel free to PM me or post here if you want to share it.

All the best!
Dax.
__________________
Dax Liniere
London's newest premium studio complex! (Facebook)
[i7-4790K, 12Gb RAM, Win8.1x64, NVidia GT710, UAD2-OCTO, FireFaceUFX, REAPER x64]
daxliniere is offline   Reply With Quote
Old 06-26-2020, 11:14 PM   #7
Archie
Human being with feelings
 
Archie's Avatar
 
Join Date: Oct 2017
Location: Russia
Posts: 221
Default

@daxliniere
Take a look at this.
Archie_Item; Move selected items to each other.lua
github
__________________
=================================
ReaPack| Archie-ReaScript: Discussion | Donate | Donate2 | Donate3 |
Archie is offline   Reply With Quote
Old 06-27-2020, 04:53 AM   #8
daxliniere
Human being with feelings
 
daxliniere's Avatar
 
Join Date: Nov 2008
Location: London, UK
Posts: 2,024
Default

Thanks Archie, I'll try that out.

All the best!
__________________
Dax Liniere
London's newest premium studio complex! (Facebook)
[i7-4790K, 12Gb RAM, Win8.1x64, NVidia GT710, UAD2-OCTO, FireFaceUFX, REAPER x64]
daxliniere is offline   Reply With Quote
Old 06-28-2020, 06:56 PM   #9
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 1,200
Default

Here's one I wrote that does what you want... I believe:

It spaces out items (using the first item as an anchor) by X seconds between items. So if you choose "0" (zero) it will close the gaps.

Code:
--[[  Written by Thonex aka Andrew K
      
      Instructions:
      Simply select all the Item you want moved (even across multiple tracks).
      The first selected item on a track will be the “anchor” (meaning it won’t be moved) and
      all the other items will be moved according to the number os seconds you entered in the
      input field.
      You can use decimal also. If you want silence of 1:30 min then enter “90” as your seconds of silence.
--]]
function Msg (param)
  reaper.ShowConsoleMsg(tostring (param).."\n")
end

function Add_X_Seconds_Space_Before_Selected_Items ()
  reaper.PreventUIRefresh(1)
  reaper.ClearConsole() 
  reaper.Undo_BeginBlock()


  retval, retvals_csv = reaper.GetUserInputs( "Add Silence Before Selected Items", 1, "X seconds", 2 )
  --Msg(reval)
  Num_Sel_Items = reaper.CountSelectedMediaItems(0)

  Sel_Item_ID = {}
  Item_Pos = {}
  Item_ID_Len = {}
  Item_ID_End_Pos ={}
  
  -- log slected items
  for i = 0, Num_Sel_Items - 1 do -- get all original positions and end points
    Sel_Item_ID[i] = reaper.GetSelectedMediaItem(0,i)   -- gets Item's ID
    Item_Pos[i]= reaper.GetMediaItemInfo_Value( Sel_Item_ID[i],"D_POSITION")
    Item_ID_Len[i] =  reaper.GetMediaItemInfo_Value(Sel_Item_ID[i],"D_LENGTH")
    Item_ID_End_Pos[i] =  Item_Pos[i] + Item_ID_Len[i]
    --Msg("Loop for initial info i = "..i)
  end
  
  -- move items X seconds from previous end
  i=0
  while i < Num_Sel_Items do 
  
    if  i>0 and reaper.GetMediaItemTrack(Sel_Item_ID[i]) ~= reaper.GetMediaItemTrack(Sel_Item_ID[i-1]) then
      i=i+1
     -- Msg("Next Track ".. i)
    end
  
    if i>0 then
      reaper.SetMediaItemPosition( Sel_Item_ID[i],Item_ID_End_Pos[i-1]+retvals_csv, 1 )
      --Msg(Sel_Item_ID[i])
      
      -- update Item for next process
      Item_Pos[i]= reaper.GetMediaItemInfo_Value( Sel_Item_ID[i],"D_POSITION")
      Item_ID_Len[i] =  reaper.GetMediaItemInfo_Value(Sel_Item_ID[i],"D_LENGTH")
      Item_ID_End_Pos[i] =  Item_Pos[i] + Item_ID_Len[i]
     -- Msg("Move Item: ".. i)
     -- Msg("Move by: ".. Item_ID_End_Pos[i-1]+retvals_csv)
    end
  i=i+1
  end

  reaper.PreventUIRefresh(-1)
  reaper.UpdateArrange()
  reaper.Undo_EndBlock("Insert X Seconds between Takes",-1)
  --Msg("Moved ".. Num_Sel_Items.." items adding ".. retvals_csv.. " secs of space before them.")

end

Add_X_Seconds_Space_Before_Selected_Items ()
There's a small bug if a track only has 1 selected item on it, it won't know what to do (since there's not 2nd item to space) and will throw a harmless error.
__________________
Cheers,
Andrew K
v6.03+dev0114 - January 14 2020 • Mac 10.12.+ • i7 Quad 2.9GHz • 24GB

Last edited by Thonex; 06-28-2020 at 07:10 PM.
Thonex is online now   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 12:57 AM.


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