Boommmm, necro’ing, adding a feature request with no shame ,
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?
Djeroek,
Try this tool. The menu entries are found in the instrument box context menu.
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
Use it all the time to make a distinction between the samples that have and haven’t been used yet.
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
}
That’s up to you . 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;
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.