Instrument column randomizer

Hey, does anyone know of any way you can randomize the instrument column, preferably within a defined range? Similar to the randomize notes tool perhaps. I want to speed up my workflow for hocketing between different vsts. Thanks.

think you might have to do it manually… or write a lua tool for it!

randomize (or humanize) selection has no effect on the instrument number column, and there isn’t an option for randomization in the advanced editor panel

update, i did that. sort of. i copied the random range track tool and modified it to affect the instrument column.

I’ve pasted the relevant code if you’re interested. The only changes are to affecting the instrument column and to not overwrite start and end lines.

--randomize instrument
local function random_range_track_instrument()
  local song=renoise.song()
  local spt=song.selected_pattern_track
  local sel=song.selection_in_pattern
  local range={sel.start_line,sel.end_line}
  --rprint(range)
  if (sel~=nil) and not song.selected_effect_column then
    local val_1={}
    local val_2={}
    for ncl=1,12 do
       val_1[ncl]=spt:line(range[1]):note_column(ncl).instrument_value
      val_2[ncl]=spt:line(range[2]):note_column(ncl).instrument_value
    end
    --rprint(val_1)
    --print("-------------------------")
    --rprint(val_2)
    for lne=range[1]+1,range[2]-1 do
      --instrument value only
      for ncl=1,12 do
        local instrument_col=spt:line(lne):note_column(ncl)
        if (instrument_col.is_selected) then
          --instrument
          if (instrument_col.instrument_value<120) then
            --print(val_1[ncl],val_2[ncl])
            if (val_1[ncl]<120) and (val_2[ncl]<120) then
              if (val_1[ncl]<val_2[ncl]) then
                instrument_col.instrument_value=math.random(val_1[ncl],val_2[ncl])
              elseif (val_1[ncl]>val_2[ncl]) then
                instrument_col.instrument_value=math.random(val_2[ncl],val_1[ncl])
              end
            end
          end
        end
      end
    end
  else
    renoise.app():show_status("Random Range Track: first select an area whitin the instrument columns for randomize the instrument!")
  end
end

renoise.tool():add_menu_entry{
  name=("Pattern Editor:Selection:Randomize Instrument (Range Track)"),
  invoke=function() random_range_track_instrument() end
}

renoise.tool():add_keybinding {
  name=("Pattern Editor:Selection:Randomize Instrument (Range Track)"),
  invoke=function() random_range_track_instrument() end
}
2 Likes

How would I go ahead and utilize this code snippet? Could you perhaps share the modified tool? The ability to randomize instruments is something I have been missing since day one with Renoise.

main.lua (8.4 KB)
Here is the edited tool. copy it over the main.lua in the random range tool folder.
If you were interested in how you would use the code, you would just copy the code from my previous post and paste it into the lua script for the tool i linked. But sending you the tool is easier. I included a hotkey binding to make it easy to use.

Great! Got it to work. Thank you so much!