Remove Empty Samples


Can you add new option in right mouse button [pop up] menu [when you are in sample slots] to
Remove empty sample slots?

You can put it at the bottom of the popup menu, so it will look like this:

Rename Instrument

Delete Unreferenced Instruments
Remove Empty Sample Slots
Delete All Instruments

It will speed up a lot of time sorting instruments instead moving sample by sample up or down and sort manually.

Maybe you can create “Remove Empty Samples And Sort by Name” instead?


I miss the “delete unused samples” option as well ;)

YES, i ALSO FELT THE NEED FOR THIS <= (sorry I was tracking :rolleyes:)

yes, and the sorting thing is also a nice idea, while I often have huge gabs between the slots.

EDIT: I was thinking a bit about the sorting stuff.
sorting on name is not a good Idea I think, because you may have grouped your samples already like:pads,percussion,ect.
instead just get rid of the gabs like this:

grandma farting

grandma farting

You are right! But it could help if someone really wants to sort samples, so menu will look like…:

Rename Instrument

Delete Unreferenced Instruments
Remove Empty Sample Slots
Sort Samples by Name
Delete All Instruments



It seems crazy to have to write a tool just to sort samples by name. Is there already a tool that does this?

Here’s something I hacked together, which you could in theory use to sort samples by any available sample property. Just write your own comparator and call sort_samples() with that function name as an argument:

-- Comparator functions
local comparator_name_asc = function (s1, s2)
  return <

local comparator_name_desc = function (s1, s2)
  return comparator_name_asc(s1, s2) == false

local comparator_length_asc = function (s1, s2)
  if s1.sample_buffer.has_sample_data == true and s2.sample_buffer.has_sample_data == false then
    return false
  elseif s2.sample_buffer.has_sample_data == true and s1.sample_buffer.has_sample_data == false then
    return true
  elseif s1.sample_buffer.has_sample_data == true and s2.sample_buffer.has_sample_data == true then
    return s1.sample_buffer.number_of_frames < s2.sample_buffer.number_of_frames
    return false

local comparator_length_desc = function (s1, s2)
  return comparator_length_asc(s1, s2) == false

-- Primary sort function
function sort_samples( comparator )
  local tbl =
  local num_swaps = 0
  for i = 2, #tbl do
    local k = i
    while ( k > 1 and comparator(tbl[k], tbl[k-1]) ) do, (k-1))
      tbl =
      num_swaps = num_swaps + 1
      k = k-1
  -- iterate if needed
  if num_swaps > 0 then sort_samples(comparator) end

-- Calling
-- By name, ascending
sort_samples( comparator_name_asc )

-- By name, descending
-- sort_samples( comparator_name_desc )

-- By sample length, shortest to longest
-- sort_samples( comparator_length_asc )

-- By sample length, longest to shortest
-- sort_samples( comparator_length_desc )

It uses the insertion sort algorithm, which may not be the fastest in the world, but it gets the job done. If enough people care enough, I might put together a tool to add items to the right-click menu in the instrument’s sample list.

Cheers, and enjoy!

Thanks! Just noticed reply, I didn`t have opportunity to login here due to malware I had since March 2020. Now seems I’m back on a Track :wink: