Hi, I’m trying to figure out how to copy a Note-On Layer to Note-Off Layer.
Ideally I’d like it to function like this
C-4 plays C-4
Off plays C-5.
This is how I used to have it set up as, but it does not seem to work with Renoise 3.1.1 anymore.
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_index
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:Copy note-on to note-off layer +12", invoke = octup}
renoise.tool():add_menu_entry {name="Sample Mappings:Copy note-on to note-off layer +24", invoke = octuptwo}
renoise.tool():add_menu_entry {name="Sample Mappings:Copy note-on to note-off layer", invoke = norm}
renoise.tool():add_menu_entry {name="Sample Mappings:Copy note-on to note-off layer -12", invoke = octdn}
renoise.tool():add_menu_entry {name="Sample Mappings:Copy note-on to note-off layer -24", invoke = octdntwo}