I think it’s a great idea! To do it with a MIDI knob, add this code to the “GlobalMidiActions.lua” file :

[luabox]

add_action(“Loop Sequence:Loop Start [Set]”,

function(message)

local sequences = renoise.song().sequencer.pattern_sequence

local loop_end = renoise.song().transport.loop_sequence_end

local loop_start = renoise.song().transport.loop_sequence_start

if message:is_rel_value() then

local value = math.ceil(message.int_value / 64)

local new_start = math.min(math.max(loop_start + value, 0), #sequences)

local new_end = math.max(loop_end, new_start)

renoise.song().transport.loop_sequence_range = {new_start, new_end}

elseif message:is_abs_value() then

local value = math.ceil((message.int_value/128) * #sequences)

local new_start = math.min(value, #sequences)

local new_end = math.max(loop_end, new_start)

renoise.song().transport.loop_sequence_range = {new_start, new_end}

end

end)

add_action(“Loop Sequence:Loop End [Set]”,

function(message)

local sequences = renoise.song().sequencer.pattern_sequence

local loop_end = renoise.song().transport.loop_sequence_end

local loop_start = math.max(renoise.song().transport.loop_sequence_start, 1)

if message:is_rel_value() then

local value = math.ceil(message.int_value / 64)

local new_end = math.min(math.max(loop_end + value, 0), #sequences)

local new_start = math.min(loop_start, new_end)

renoise.song().transport.loop_sequence_range = {new_start, new_end}

elseif message:is_abs_value() then

local value = math.ceil(message.int_value / 128 * #sequences)

local new_end = value

local new_start = math.min(loop_start, new_end)

if new_start > new_end then new_end = 0 end

renoise.song().transport.loop_sequence_range = {new_start, new_end}

end

end)

[/luabox]

In my opinion it’s more convenient to set the start point with one knob (looping is disabled if 0), and to set the length of the loop with another. I guess it’s a matter of taste… Here’s how to do it like this :

[luabox]

add_action(“Loop Sequence:Loop Start (fixed loop length) [Set]”,

function(message)

local sequences = renoise.song().sequencer.pattern_sequence

local loop_end = renoise.song().transport.loop_sequence_end

local loop_start = renoise.song().transport.loop_sequence_start

local loop_length = loop_end - loop_start

if message:is_rel_value() then

local value = math.ceil(message.int_value / 64)

local new_start = math.min(math.max(loop_start + value, 0), #sequences)

local new_end = math.min(new_start + loop_length, #sequences)

renoise.song().transport.loop_sequence_range = {new_start, new_end}

elseif message:is_abs_value() then

local value = math.ceil((message.int_value/128) * #sequences)

local new_start = math.min(value, #sequences)

local new_end = math.min(new_start + loop_length, #sequences)

renoise.song().transport.loop_sequence_range = {new_start, new_end}

end

end)

add_action(“Loop Sequence:Loop Length [Set]”,

function(message)

local sequences = renoise.song().sequencer.pattern_sequence

local loop_end = renoise.song().transport.loop_sequence_end

local loop_start = renoise.song().transport.loop_sequence_start

if message:is_rel_value() then

local value = math.ceil(message.int_value / 64)

local new_start = loop_start

local new_end = math.min(math.max(loop_end + value, new_start), #sequences)

renoise.song().transport.loop_sequence_range = {new_start, new_end}

elseif message:is_abs_value() then

local value = math.ceil(message.int_value / 128 * #sequences)

local new_start = loop_start

local new_end = math.min(new_start + value, #sequences)

renoise.song().transport.loop_sequence_range = {new_start, new_end}

end

end)

[/luabox]