Samples Loop_Mode,Loop_Release, Loop_Start, Loop_End

Hiya. I was doing some random grepping along the documentation, and got these;[].samples[].loop_mode, _observable[].samples[].loop_release, _observable[].samples[].loop_start, _observable[].samples[].loop_end, _observable

Am I to understand that the loop_mode of a sample can be changed via LUA? or that one can LUA script sample loop_start & end lengths, etc? Or?

yes, IT-Alien made it possible to midi control start and end loop points some time back.

Ok, looking further, it seems that there can be a


These seem to be the old foes, constants :)

Only used for[].samples[].loop_mode

Example:[1].samples[1].loop_mode = renoise.Sample.LOOP_MODE_REVERSE  

Think of a constant as a shortcut. Except it’s not shorter, rather verbose and easier to read.

Okay, I got this going now: = renoise.Sample.LOOP_MODE_OFF = renoise.Sample.LOOP_MODE_REVERSE = renoise.Sample.LOOP_MODE_PING_PONG
For some reason, loop_mode_forward just doesn’t want to work, which is weird!

So far so good

>>> oprint (  

worked :)
I don’t get why FORWARD doesn’t work? :)

Set a loop to forward and then query that samples loop value via the lua console. Maybe things will clarify. I would guess that the constants are 0,1,2,3.

This switches between sample loop mode “off” and “forward”

function toggle_sample_looping()  
 local loop_mode =  
 if loop_mode == 1 then  
 loop_mode =2  
 loop_mode = 1  
 end = loop_mode  

1, 2, 3, 4

Ok, made a little keybind which tries to think in mathematical terms.

function selsamploop()  
local selsamp =  
if selsamp.loop_end <200 then  
selsamp.loop_end =  
 if selsamp.loop_end >3000 then  
 selsamp.loop_end = selsamp.loop_end - 1000  
 else selsamp.loop_end = selsamp.loop_end -100  

If anyone has any suggestions as to how to handle samples of different sizes mathematically so that this kind of loop-setting and re-setting and “closer to sample_start starts increasing resolution” makes more sense, please suggest.

edit: Well, added one more thing, every second press on the keybind will switch from pingpong to forward loop. Just mucking about, really. (didn’t add it to the code, cos why?)
edit: v0.39 Impulsecomplex has cycle off-forward-backward-pingpong and pingpong-backward-forward-off shortcuts and set-off, set-forward, set-backward, set-pingpong shortcuts. :)