Script In Testing: Capslock/noteoff Replacement

Hi, just knocked this up, it’s a CapsLock replacement for the Native Renoise CapsLock functionality.

It functions like this:
If Pattern-wrap-mode is ON, the CapsLock will write a NoteOff to the cursor row, then advance by editstep. Once you get to the last row of the pattern, the next NoteOff will wrap you to the beginning of the pattern.

If Pattern-wrap-mode is OFF, the CapsLock will write a NoteOff till the end of pattern, and switch to the next pattern in the orderlist. NOTE: It does shoot an error when it reaches the last sequence (trying to switch to the a sequence which does not exist), and frankly my mind just couldn’t wrap around how to make sure it switches to wrapping-mode-ON behaviour (i.e. if you are in the last pattern, your note-off command will take you to the same pattern with the editstep entry).

[details=“Click to view contents”] ```
function PakettiCapsLockNoteOffNextPtn()
local s=renoise.song()
local wrapping=s.transport.wrapped_pattern_edit
local editstep=s.transport.edit_step

local currLine=s.selected_line_index
local currPatt=s.selected_sequence_index

local counter=nil
local addlineandstep=nil
local counting=nil
local seqcount=nil

s.patterns[currPatt].tracks[s.selected_track_index].lines[s.selected_line_index].note_columns[s.selected_note_column_index].note_string=“OFF”

addlineandstep=currLine+editstep
seqcount = currPatt+1

if addlineandstep > s.patterns[currPatt].number_of_lines then
print ("Trying to move to index: " … addlineandstep … " Pattern number of lines is: " … s.patterns[currPatt].number_of_lines)
counting=addlineandstep-s.patterns[currPatt].number_of_lines
if seqcount > (table.count(renoise.song().sequencer.pattern_sequence)) then
seqcount = (table.count(renoise.song().sequencer.pattern_sequence))
s.selected_sequence_index=seqcount
end
s.selected_sequence_index=currPatt+1
s.selected_line_index=counting
else
print ("Trying to move to index: " … addlineandstep … " Pattern number of lines is: " … s.patterns[currPatt].number_of_lines)
–s.selected_sequence_index=currPatt+1
s.selected_line_index=addlineandstep

counter = addlineandstep-1

renoise.app():show_status("Now on: " … counter … “/” … s.patterns[currPatt].number_of_lines … " In Pattern: " … currPatt)
end
end

function PakettiCapsLockNoteOff()
local s=renoise.song()
local wrapping=s.transport.wrapped_pattern_edit
local editstep=s.transport.edit_step

local currLine=s.selected_line_index
local currPatt=s.selected_sequence_index

local counter=nil
local addlineandstep=nil
local counting=nil
local seqcount=nil

s.patterns[currPatt].tracks[s.selected_track_index].lines[s.selected_line_index].note_columns[s.selected_note_column_index].note_string=“OFF”

addlineandstep=currLine+editstep
seqcount = currPatt+1

if addlineandstep > s.patterns[currPatt].number_of_lines then
print ("Trying to move to index: " … addlineandstep … " Pattern number of lines is: " … s.patterns[currPatt].number_of_lines)
counting=addlineandstep-s.patterns[currPatt].number_of_lines
if seqcount > (table.count(renoise.song().sequencer.pattern_sequence)) then
seqcount = (table.count(renoise.song().sequencer.pattern_sequence))
s.selected_sequence_index=seqcount
end
–s.selected_sequence_index=currPatt+1
s.selected_line_index=counting
else
print ("Trying to move to index: " … addlineandstep … " Pattern number of lines is: " … s.patterns[currPatt].number_of_lines)
–s.selected_sequence_index=currPatt+1
s.selected_line_index=addlineandstep

counter = addlineandstep-1

renoise.app():show_status("Now on: " … counter … “/” … s.patterns[currPatt].number_of_lines … " In Pattern: " … currPatt)
end
end

renoise.tool():add_keybinding {name=“Global:Paketti:Note Off / Caps Lock replacement”, invoke = function()
if renoise.song().transport.wrapped_pattern_edit == false then PakettiCapsLockNoteOffNextPtn()
else PakettiCapsLockNoteOff() end
end}

  
Some notes: 1) It is Global. Yes. You can manouver to your favorite Mixer channel, and output a NoteOff to that track. 2) It ignores Record mode, so will dump a noteoff whether you have record on or off. 3) It will shoot an error if you try to press capslock on an effect_column. 4) It will shoot an error if you try to press capslock on a Master / Send Column.