Old 06-14-2021, 03:24 PM   #1
Kaxaze music
Human being with feelings
 
Kaxaze music's Avatar
 
Join Date: Sep 2020
Location: India
Posts: 283
Default How do i Join Items Edge to Edge ?

How do i Join Items Edge to Edge in a way that they don't overlap
i hope this much info is enough to understand
Kaxaze music is offline   Reply With Quote
Old 06-14-2021, 03:46 PM   #2
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

What do you mean exactly. Getting rid of the gaps between items by cutting them away like Ripple Cut/dragging them to each other?
Or by extending the lengths of items so they hit each other?

The functions GetMediaItemInfo_Value and SetMediaItemInfo_Value might help you:

https://mespotin.uber.space/Ultrasch...ItemInfo_Value

https://mespotin.uber.space/Ultrasch...ItemInfo_Value

specifically the attributes D_POSITION and D_LENGTH should give you ways to do it.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 06-14-2021, 06:19 PM   #3
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

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-14-2021, 11:55 PM   #4
poulhoi
Human being with feelings
 
Join Date: Apr 2020
Posts: 214
Default

Check out my scripts to trim item edges to next/previous item start/end; maybe that's what you were looking for?
__________________
My repository of scripts
poulhoi is offline   Reply With Quote
Old 06-15-2021, 12:29 AM   #5
o_e
Human being with feelings
 
o_e's Avatar
 
Join Date: May 2016
Posts: 681
Default

X-Raym_Move selected items to end of previous items on all visible tracks.lua
o_e is offline   Reply With Quote
Old 06-15-2021, 01:47 AM   #6
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

We need details
- joining by moving items ?
- joining by triming items start/end ?
- joining by trimming items start/end keeping take content in place ?


There are scripts for every case. Look for Trim, Extend, Expand, Repositions etc keywords.
X-Raym is offline   Reply With Quote
Old 06-16-2021, 01:43 AM   #7
Kaxaze music
Human being with feelings
 
Kaxaze music's Avatar
 
Join Date: Sep 2020
Location: India
Posts: 283
Default



this is what i want
Kaxaze music is offline   Reply With Quote
Old 06-16-2021, 03:56 AM   #8
Yanick
Human being with feelings
 
Yanick's Avatar
 
Join Date: May 2018
Location: Moscow, Russia
Posts: 612
Default

Sometime before I did two scripts for this


1) Reposition items on each track
Code:
  
  function bla() end
  function nothing() reaper.defer(bla) end
  local count_items = reaper.CountSelectedMediaItems(0)
  if count_items > 0 then
    reaper.Undo_BeginBlock()
    reaper.PreventUIRefresh(1)
    for i=0, count_items-1 do
      local get_item = reaper.GetSelectedMediaItem(0,i)
      if get_item then
        local item_track = reaper.GetMediaItem_Track(get_item)
        local start_item = reaper.GetMediaItemInfo_Value(get_item, 'D_POSITION')
        local end_item = start_item + reaper.GetMediaItemInfo_Value(get_item, 'D_LENGTH')
        local get_item_2 = reaper.GetSelectedMediaItem(0,i+1)
        if get_item_2 then
          local item_track_2 = reaper.GetMediaItem_Track(get_item_2)
          if item_track == item_track_2 then
            reaper.SetMediaItemInfo_Value(get_item_2, 'D_POSITION', end_item)
          end
        end
      end
    end
    reaper.Undo_EndBlock('Auto reposition items',-1)
    reaper.PreventUIRefresh(-1)
  else
    nothing()
  end




2) Reposition items relative to any track


Code:
  function bla() end
  function nothing()
    reaper.defer(bla)
  end
  
  if reaper.CountSelectedMediaItems(0) == 0 then
    nothing() return
  end
  
  reaper.Undo_BeginBlock()
  reaper.PreventUIRefresh(1)
  
  local t = {}
  
  for i=1, reaper.CountSelectedMediaItems(0) do
    local item = reaper.GetSelectedMediaItem(0,i-1)
    local start_item = reaper.GetMediaItemInfo_Value(item,'D_POSITION')
    t[i] = {item, start_item}
  end
  
  table.sort(t, function(a,b) return b[2] > a[2] end)
  
  for i=1, #t do
    local item_end =
    reaper.GetMediaItemInfo_Value(t[i][1],'D_POSITION') + reaper.GetMediaItemInfo_Value(t[i][1],'D_LENGTH')
    if t[i+1] then
      reaper.SetMediaItemInfo_Value(t[i+1][1],'D_POSITION', item_end)
    end
  end
  
  reaper.Undo_EndBlock('Reposition selected items relative to any track', -1)
  reaper.PreventUIRefresh(-1)

Last edited by Yanick; 06-16-2021 at 04:18 AM.
Yanick is offline   Reply With Quote
Old 06-16-2021, 04:33 AM   #9
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

You can also try these on ReaPack:
- amagalma_Close gaps (remove space) between all items of selected tracks
- amagalma_Close gaps (remove space) between selected items
__________________
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 06-16-2021, 01:25 PM   #10
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

Quote:
Originally Posted by o_e View Post
X-Raym_Move selected items to end of previous items on all visible tracks.lua



You have so many ways similar scripts to do this :P
X-Raym 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 05:17 PM.


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