So I’m pretty sure Chatgtp just wrote the entire script for a load of keyboard shortcuts that I’ve been wanting. Did Chatgtp get anything wrong?
– Script Name: Sampler Shortcuts
– Version: 1.0
– Author: Your Name
– Function to set loop mode for the highlighted sample
local function setLoopMode(mode)
if renoise.app().window.active_middle_frame == renoise.AppWindow.MIDDLE_FRAME_SAMPLER then
renoise.song().instruments[renoise.song().selected_instrument_index].samples[renoise.song().selected_sample_index].loop_mode = mode
end
end
– Function to set modulation for the highlighted sample
local function setModulation(modulation)
if renoise.app().window.active_middle_frame == renoise.AppWindow.MIDDLE_FRAME_SAMPLER then
renoise.song().instruments[renoise.song().selected_instrument_index].samples[renoise.song().selected_sample_index].modulation_set_number = modulation
end
end
– Function to set FX for the highlighted sample
local function setFX(fx)
if renoise.app().window.active_middle_frame == renoise.AppWindow.MIDDLE_FRAME_SAMPLER then
renoise.song().instruments[renoise.song().selected_instrument_index].samples[renoise.song().selected_sample_index].fx_set_number = fx
end
end
– Function to toggle Quick Fade for the highlighted sample
local function toggleQuickFade()
if renoise.app().window.active_middle_frame == renoise.AppWindow.MIDDLE_FRAME_SAMPLER then
local sample = renoise.song().instruments[renoise.song().selected_instrument_index].samples[renoise.song().selected_sample_index]
sample.use_quickfade = not sample.use_quickfade
end
end
– Function to toggle Velocity Tracking for the highlighted sample
local function toggleVelocityTracking()
if renoise.app().window.active_middle_frame == renoise.AppWindow.MIDDLE_FRAME_SAMPLER then
local sample = renoise.song().instruments[renoise.song().selected_instrument_index].samples[renoise.song().selected_sample_index]
sample.use_velocity_tracking = not sample.use_velocity_tracking
end
end
– Function to apply the specified operation to all samples
local function applyOperationToAll(operationFunction)
if renoise.app().window.active_middle_frame == renoise.AppWindow.MIDDLE_FRAME_SAMPLER then
for _, sample in ipairs(renoise.song().instruments[renoise.song().selected_instrument_index].samples) do
operationFunction(sample)
end
end
end
– Function to set loop mode for all samples
local function setLoopModeAll(mode)
applyOperationToAll(function(sample) sample.loop_mode = mode end)
end
– Function to set modulation for all samples
local function setModulationAll(modulation)
applyOperationToAll(function(sample) sample.modulation_set_number = modulation end)
end
– Function to set FX for all samples
local function setFXAll(fx)
applyOperationToAll(function(sample) sample.fx_set_number = fx end)
end
– Function to toggle Quick Fade for all samples
local function toggleQuickFadeAll()
applyOperationToAll(function(sample) sample.use_quickfade = not sample.use_quickfade end)
end
– Function to toggle Velocity Tracking for all samples
local function toggleVelocityTrackingAll()
applyOperationToAll(function(sample) sample.use_velocity_tracking = not sample.use_velocity_tracking end)
end
– Register the tool in the Renoise menu
renoise.tool():add_menu_entry {
name = “Main Menu:Tools:Set Loop Off”,
invoke = function() setLoopMode(renoise.Sample.LOOP_MODE_OFF) end
}
renoise.tool():add_menu_entry {
name = “Main Menu:Tools:Set Loop Forward”,
invoke = function() setLoopMode(renoise.Sample.LOOP_MODE_FORWARD) end
}
renoise.tool():add_menu_entry {
name = “Main Menu:Tools:Set Loop Backward”,
invoke = function() setLoopMode(renoise.Sample.LOOP_MODE_BACKWARD) end
}
renoise.tool():add_menu_entry {
name = “Main Menu:Tools:Set Loop Ping Pong”,
invoke = function() setLoopMode(renoise.Sample.LOOP_MODE_PING_PONG) end
}
renoise.tool():add_menu_entry {
name = “Main Menu:Tools:Disable Loop Exit”,
invoke = function() renoise.song().samples[renoise.song().selected_sample_index].loop_release = false end
}
renoise.tool():add_menu_entry {
name = “Main Menu:Tools:Enable Loop Exit”,
invoke = function() renoise.song().samples[renoise.song().selected_sample_index].loop_release = true end
}
renoise.tool():add_menu_entry {
name = “Main Menu:Tools:Set Mod None”,
invoke = function() setModulation(0) end
}
renoise.tool():add_menu_entry {
name = “Main Menu:Tools:Set Mod 1”,
invoke = function() setModulation(1) end
}
renoise.tool():add_menu_entry {
name = “Main Menu:Tools:Set Mod 2”,
invoke = function() setModulation(2) end
}
renoise.tool():add_menu_entry {
name = “Main Menu:Tools:Set Mod 3”,
invoke = function() setModulation(3) end
}
renoise.tool():add_menu_entry {
name = “Main Menu:Tools:Set FX None”,
invoke = function() setFX(0) end
}
renoise.tool():add_menu_entry {
name = “Main Menu:Tools:Set FX 1”,
invoke = function() setFX(1) end
}
renoise.tool():add_menu_entry {
name = “Main Menu:Tools:Set FX 2”,
invoke = function() setFX(2) end
}
renoise.tool():add_menu_entry {
name = “Main Menu:Tools:Set FX 3”,
invoke = function() setFX(3) end
}
renoise.tool():add_menu_entry {
name = “Main Menu:Tools:Disable Quick Fade”,
invoke = function() toggleQuickFade() end
}
renoise.tool():add_menu_entry {
name = “Main Menu:Tools:Enable Quick Fade”,
invoke = function() toggleQuickFade() end
}
renoise.tool():add_menu_entry {
name = “Main Menu:Tools:Disable Velocity Tracking”,
invoke = function() toggleVelocityTracking() end
}
renoise.tool():add_menu_entry {
name = “Main Menu:Tools:Enable Velocity Tracking”,
invoke = function() toggleVelocityTracking() end
}
– Register shortcuts for all samples
renoise.tool():add_keybinding {
name = “Global:Tools:Set Loop Off ALL”,
invoke = function() setLoopModeAll(renoise.Sample.LOOP_MODE_OFF) end
}
renoise.tool():add_keybinding {
name = “Global:Tools:Set Loop Forward ALL”,
invoke = function() setLoopModeAll(renoise.Sample.LOOP_MODE_FORWARD) end
}
renoise.tool():add_keybinding {
name = “Global:Tools:Set Loop Backward ALL”,
invoke = function() setLoopMode