Something like this:
There already is such a menu entry in the sample list inside an instrument. Or did you mean something else?
If you want to duplicate this for the instrument box, this is a start:
Click to view contents
local function load_sample()
local path = renoise.app():prompt_for_filename_to_read({"*"}, "Select sample")
if (path == "") then return end -- user pressed cancel
local inst = renoise.song().selected_instrument
local sample_index = #inst.samples + 1
local sample = inst:insert_sample_at(sample_index)
sample.sample_buffer:load_from(path)
-- illegal file was chosen. remove sample slot.
if (sample.sample_buffer.number_of_frames == 0) then
inst:delete_sample_at(sample_index)
else
-- do renaming of instr and/or sample here
end
end
renoise.tool():add_menu_entry {
name = "Instrument Box:Load Sample...",
invoke = load_sample
}