Copy Slice Markers


(FOXBUNNY) #1

I’ve just found out that you cannot copy and paste individual slice markers (or all of them) into another sample. It would be nice to be able to Ctrl-C/Ctrl-P markers to another sample at the exact same position it was in in the original sample.


(zooterman) #2

Totally needed!!


(Raul (ulneiz)) #3

As far as I know, it is possible to do it using a tool, at least all the markers. But the target sample should be equally long that the original. With the API available I do not know how to obtain the last available position of the selected sample. If there is some way in the API to get the maximum value from the sample position, creating a tool would be very easy.

Reference:

  • property: .slice_markers (table)
  • method: :insert_slice_marker (mark_pos)

But I do not find anything to obtain the maximum possible value of the position in the sample. It is necessary to shield the paste function.

main.lua v1.0
local SLC_MAIN_TBL={}
local function slc_copy_slice_table()
  local song=renoise.song()
  local max=#song.selected_instrument:sample(song.selected_sample_index).slice_markers
  for sam_pos=1,max do
    SLC_MAIN_TBL[sam_pos]=song.selected_instrument:sample(song.selected_sample_index).slice_markers[sam_pos]
  end
  print("copy:")
  rprint(SLC_MAIN_TBL)
end

local function slc_paste_slice_table()
  local song=renoise.song()
  for sam_pos=1,#SLC_MAIN_TBL do
    song.selected_instrument:sample(song.selected_sample_index):insert_slice_marker(SLC_MAIN_TBL[sam_pos])
  end
  print("paste:")
  rprint(song.selected_instrument:sample(song.selected_sample_index).slice_markers)
end



--menu entry
renoise.tool():add_menu_entry{
  name=("Sample Editor:Copy Markers"),
  invoke=function() slc_copy_slice_table() end
}
renoise.tool():add_menu_entry{
  name=("Sample Editor:Paste Markers"),
  invoke=function() slc_paste_slice_table() end
}

(joule) #4

(Raul (ulneiz)) #5

Thank you very much @joule. With this I can make a simple tool. I have barely made tools related to the manipulation of samples. I still have to familiarize myself a little with the related API.


(Raul (ulneiz)) #6

I just launched a tool in the tools section of www.renoise.com. It’s called Slice Importer.

https://www.renoise.com/tools/slice-importer

Enjoy!