[Done] tag sampled instruments that aren't used (yet)

Was wondering, for another tool idea, would it be possible to fetch the sample length in time and put that in front of the sample name? Just like your tool now puts in the count, put in front the length in time?

Makes it more easy to differentiate between long and short samples by just looking at the instrument list, negates the need to check in sample editor.

The instrument list contains instruments and not samples. It is possible if you add the size for all samples, for example. Maybe someone else wants to do it? I think it is too ugly.

There are different ways to notate time, I think it could be handy, hope someone will pick it up :D

Djeroek,

After considering your proposal, ideally, I want to extend the “Organize instruments” tool with a window showing a list with extended information of all instruments (total samples, total slices, seconds long (basenote), et c). This could include the possibility to append any information available to the instrument name.

It takes a while to do this, and I think it might be better to wait for the next version of Renoise to see if the lua API will bring anything new in terms of gui (lists, dragndrop et c).

Thanks for bringing ideas!

Wow, sounds great! It would probably be better to call the extended tool something like “Instrument manager” instead. Godspeed!

(And let’s hope the new release pops out of oven some time soon ;))

Sounds good!

Thanks for the scripting magick!

Ey Joule,

I got this message:

After pressing cancel in the standard pop-up window when a script is taking to long to respond. Was playing back a cpu heavy track while running the script and decided it wasn’t worth the wait after the audio started stuttering.

Oy, I use this script quite often, wonder if you can extend the counting to the sample list in ‘Instrument Settings’? (pretty please :yeah: ) Either automatically through the original script use, or optional through right mouse clicking / selecting the script in the Sample list in ‘Instrument Settings’.

Sure. I’ll just have to investigate how samples (and slices?) are handled. A sample can be triggered either by being mapped to a particular key, or via an override effect command, right?

It will be quite tedious keeping track of samples with velocity mapping. I predict the tool will be a bit slow, having to scan several columns in the song.

I’m not using pattern command SXX to trigger slices of multi-sampled instruments, just different notes. Maybe keep it to differentiating & counting note-events and not keep track of velocity mappings if it is too slow?

I’ll do it proper and generic if doing it at all :)

had a bug today:

Boommmm, necro’ing, adding a feature request with no shame :ph34r: ,

I’m looking for a tool that can add sample info at end of a sample’s name. As the quoted tool underneath adds stuff to the beginning of the instruments name, I thought this would be a good candidate for feature pimping, though the sort instruments tool might be a good candidate as well ( https://forum.renoise.com/t/updated-tool-3-1-sort-instruments/34208 )

Probably trivial for most, but I’m looking for a tool which goes through the instrument list and can add stuff like the sample’s length, mono or stereo properties, sample rate/bit rate, other info(?) at the end of a instrument name. Maybe these properties can be selected in some kind of gui, if you just want one or the other.

I know these can be figured out from within Renoise, the main objective is to batch save samples and be able to categorize them based on the used name settings. Maybe it can be useful for others as well? B)

Project for when you bored, Joule? :stuck_out_tongue:

Djeroek,

Try this tool. The menu entries are found in the instrument box context menu.

http://forum.renoise.com/index.php?app=core&module=attach&section=attach&attach_id=3746

EDIT: I just reviewed my code and this is the first time a piece of code got me laughing.
It contains some awesome feats like “)” … " " instead of ") "

Joule, do you still have a working link to it / version of this tool? I’m on a new computer and can’t find it :frowning:
Use it all the time to make a distinction between the samples that have and haven’t been used yet.

Oh… Sorry, that was several computers ago. Maybe admin can fix the link?

(It’s a good project for someone who wants to learn a bit of scripting otherwise!)

1 Like

I still have the hd of my previous comp with the tools extracted to the renoise scripts folder, so will try if I can repack it eventually, if an admin can’t retrieve it anymore.

I asked chatgpt to come up with a solution for adding to your sort instrument tool (Updated Tool (3.1): Sort Instruments), and if you paste and execute the following in the script editor, it’ll add a feature to count the amount of times an instrument is used and will prepend the amount to the sample name;

-- Count the number of times a sample is used in the song and prepend the count to the sample name
function prepend_sample_usage_to_name()

  -- Create a table to track usage counts for each instrument
  local usage_counts = {}
  for i = 1, #renoise.song().instruments do
    usage_counts[i] = 0
  end

  -- Scan through all patterns, tracks, and note columns to count usage
  for _, pattern_index in ipairs(renoise.song().sequencer.pattern_sequence) do
    local pattern = renoise.song():pattern(pattern_index)
    for track_index = 1, renoise.song().sequencer_track_count do
      local track = pattern:track(track_index)
      for line_index, line in ipairs(track.lines) do
        if not line.is_empty then
          for note_column_index = 1, renoise.song():track(track_index).visible_note_columns do
            local note_column = line:note_column(note_column_index)
            if not note_column.is_empty and note_column.instrument_value ~= 255 then
              -- Increment the count for the instrument used in this note column
              usage_counts[note_column.instrument_value + 1] = usage_counts[note_column.instrument_value + 1] + 1
            end
          end
        end
      end
    end
  end

  -- Update the instrument names to prepend the usage count
  for i, instrument in ipairs(renoise.song().instruments) do
    if usage_counts[i] > 0 then
      -- Remove any existing usage count from the name before prepending the updated count
      local new_name = instrument.name:gsub("^%d+%s%-%s", "")

      -- Prepend the usage count to the instrument name
      new_name = usage_counts[i] .. " - " .. new_name
      instrument.name = new_name
    end
  end

end

-- Add the function to the tool menu
renoise.tool():add_menu_entry {
  name = "Instrument Box:Sort Instruments...:Update Sample Usage Count",
  invoke = function() prepend_sample_usage_to_name() end
}

hi, so, was this an abandoned tool? I can add it to my todo-list and recreate it and add it to Paketti.
any additional features you want added?

That’s up to you :slight_smile: . Since I’ve added it hackily myself and can use chatgpt for variations or finetuning to my specific wishes I’m happy here.

One thing that bugs me about the instrument list, is that it can feel like a bit of a mess when different instrument types are used. Sample names wont allign from top to bottom as some will be shifted because you have used fx in the instrument editor.

Ideally I want to refactor the code so it should check if the instrument contains any fx in the instrument editor and if not, will shift the instrument name a few spaces to the right so the names better align, something like this as a result;
image

More visually pleasant for my autism :wink:

1 Like

Chatgpt ftw, I’ve asked it for a solution and it came up with this after some trial and error;

-- Function to check if an instrument uses effects or has an empty FX chain and adjust name accordingly
function align_instrument_names()
  local song = renoise.song()
  
  for i, instrument in ipairs(song.instruments) do
    local name = instrument.name
    
    -- Check if the instrument uses effects in the instrument editor or has an empty FX chain
    local uses_fx = false

    -- Check for FX chains (even empty ones should be counted as using FX)
    if #instrument.sample_device_chains > 0 then
      uses_fx = true  -- FX chain exists, even if empty, it adds an icon in the GUI
    end

    -- If instrument uses effects or has an empty FX chain, remove leading spaces
    if uses_fx then
      -- Remove the 5 spaces if the instrument was previously aligned
      instrument.name = name:gsub("^%s%s%s%s%s", "")
    else
      -- If instrument does not use effects, add 5 spaces if not already aligned
      if not name:match("^%s%s%s%s%s") then
        instrument.name = "     " .. name
      end
    end
  end
end

-- Add a menu entry for the tool in Renoise under the "Tools" menu
renoise.tool():add_menu_entry {
  name = "Main Menu:Tools:Align Instrument Names",
  invoke = function() align_instrument_names() end
}

This will create an imaginary column for the fx icon in the instrument selector window.