Is there a way of copying a sample from the Note-On Layer to the Note-Off Layer using LUA API, or has that been misplaced by the API altogether?
I used to have a functioning script that would let me copy samples from note-on layer to note-off layer and even change the pitch, which was amazing. @vvoois wrote it i think. i tried to modify it to work with Renoise 3 but it doesn’t seem to.
here’s what i’m working with
--vV's wonderful sample keyzone noteon/noteoff copier + octave transposition for note-off:
local NOTE_ON = renoise.Instrument.LAYER_NOTE_ON
local NOTE_OFF = renoise.Instrument.LAYER_NOTE_OFF
local function copy_note_layers(source_layer,target_layer,offset)
local instrument = renoise.song().selected_instrument_index
--delete target layers prior to copying (to prevent overlays)
if #renoise.song().instruments[instrument].sample_mappings[target_layer] > 0 then
--Note that when using the delete_sample_mapping, the index is changing on-the-fly
--So you have to remove the mappings from the last to the first entry instead of vice versa.
--Else you get errors half-way.
for i = #renoise.song().instruments[instrument].sample_mappings[target_layer],1,-1 do
renoise.song().instruments[instrument]:delete_sample_mapping_at(target_layer, i)
end
end
for i = 1,#renoise.song().instruments[instrument].sample_mappings[source_layer] do
local base_note = renoise.song().instruments[instrument].sample_mappings[source_layer][i].base_note
local map_velocity_to_volume = renoise.song().instruments[instrument].sample_mappings[source_layer][i].map_velocity_to_volume
local note_range = renoise.song().instruments[instrument].sample_mappings[source_layer][i].note_range
local sample_index = renoise.song().instruments[instrument].sample_mappings[source_layer][i].sample
-- local use_envelopes = renoise.song().instruments[instrument].sample_mappings[source_layer][i].use_envelopes
local velocity_range = renoise.song().instruments[instrument].sample_mappings[source_layer][i].velocity_range
local oct_base_note=nil
oct_base_note=base_note+offset
renoise.song().instruments[instrument]:insert_sample_mapping(target_layer, sample_index,oct_base_note,note_range,velocity_range)
end
end
local function norm() copy_note_layers(NOTE_ON, NOTE_OFF, 0) end
local function octdn() copy_note_layers(NOTE_ON, NOTE_OFF, 12) end
local function octup() copy_note_layers(NOTE_ON, NOTE_OFF, -12) end
local function octdntwo() copy_note_layers(NOTE_ON, NOTE_OFF, 24) end
local function octuptwo() copy_note_layers(NOTE_ON, NOTE_OFF, -24) end
renoise.tool():add_menu_entry{name="--Sample Mappings:Paketti..:Copy Note-On to Note-Off Layer +12", invoke = octup}
renoise.tool():add_menu_entry{name="Sample Mappings:Paketti..:Copy Note-On to Note-Off Layer +24", invoke = octuptwo}
renoise.tool():add_menu_entry{name="Sample Mappings:Paketti..:Copy Note-On to Note-Off Layer", invoke = norm}renoise.tool():add_menu_entry{name="Sample Mappings:Paketti..:Copy Note-On to Note-Off Layer -12", invoke = octdn}
renoise.tool():add_menu_entry{name="Sample Mappings:Paketti..:Copy Note-On to Note-Off Layer -24", invoke = octdntwo}