Experiment: Use Midi Knob To Set Loop Markers

update: this script is obsolete. please use the XRNX version

try putting the following into your GlobalMidiActions.lua, located into the “Scripts” folder (at the end of the file is fine)

  
  
-- BEGIN: use MIDI actions to set loop markers  
  
add_action("Selected Sample:Loop Start [Set]",  
function(message)  
  
 local sample = song().selected_sample;  
 local int_frames = sample.sample_buffer.number_of_frames;  
 local int_message = message.int_value + 1;  
  
 if message:is_rel_value() then  
 local int_frame_middle = int_frames * .5;  
 sample.loop_start = int_frame_middle + int_frame_middle * int_message / 64;  
 elseif message:is_abs_value() then  
 sample.loop_start = int_message * int_frames / 128;  
 end  
  
end)  
  
  
add_action("Selected Sample:Loop End [Set]",  
function(message)  
  
 local sample = song().selected_sample;  
 local int_frames = sample.sample_buffer.number_of_frames;  
 local int_message = message.int_value + 1;  
  
 if message:is_rel_value() then  
 local int_frame_middle = int_frames * .5;  
 sample.loop_end = int_frame_middle + int_frame_middle * int_message / 64;  
 elseif message:is_abs_value() then  
 sample.loop_end = int_message * int_frames / 128;  
 end  
  
end)  
  
-- END: use MIDI actions to set loop markers  
  

this will create two new mappable MIDI actions:
Selected Sample => Loop Start [Set]
Selected Sample => Loop End [Set]

assigning each one to a different MIDI knob will let you change the currently selected sample’s loop markers on the fly

cool! will trie this as soon as i’m back home again.

wow!!!will this ever become part of the stable release??

Woooow! Sickness, IT-Alien! :D

Will this ever be automatable (ie. next to mappable)?

would be great if this could also take into account snap settings!

coolio. :D

MAN, I can’t wait to try this!

Great fun - I have taken to increasing the 128 value to 512 or higher for the more glitchy looping (not sure if it needs to be those specific values though). Plus, we now have automatable loop points!

How do you automate this in the automation editor?

an uneducated guess: with a midi -loopback driver (midi yoke etc.), than just automate via mididevice in renoise.

meh, should be made possible natively imo :slight_smile:

I really want to hook a meta-device up to this,
and now I know it’s possible.

just haven’t figured out the important first part of porting it over to work in the GlobalOscActions file.
something about observable device parameters and notifiers, I think.
somehow it’s possible to link meta-device parameters to an OSC client, route this internally to the OSC server that controls the start and end points.

the meta-device parameters to an osc client were discussed but the method didn’t surface,
client and server communication has been discussed with examples courtesy of vV.
The last piece of the puzzle that shows the methodology in a different shape,
is right here courtesy of It-Alien.

2.5.1, is a distant planet.

Scripts are running native in Renoise ;)

the 64 and 128 values are there because of MIDI messages resolution. I don’t think that increasing them could lead to more resolution

No,I clearly messed with the wrong variable - but it still gave me finer loop points. upon increasing it to 15000, it enabled me to do some glitchy style loops, but the range was limited to the 1st quarter ot the sample, but I understand this is a limitation of having just 128 values. Maybe implementing a LSB/MSB controller wil give us finer tuning?

Still, it’s nice to see all these little scripts popping up - it makes all this scripting lark a bit easier to absorb - I just wish I went a bit further than basic back in the days of amstrads and VIC-20’s!

When can we have this as a tool?

Have you tried out It-aliens first post?

This will create two new mappable MIDI actions:
Selected Sample => Loop Start [Set]
Selected Sample => Loop End [Set]

Which is basically the tool you need?

this could be extended further:

two other MIDI actions could be added to let the user select the instrument and sample number of the target sample, so this script could be used in non-live situations, or in general to change the loop range of non selected samples

How about this first? :slight_smile:

Impossible?

I don’t think there is anything in the API which allows to determine the current snapping mode, so there should be another MIDI action to define it. This done, it should be quite simple to accomplish.

by reading my last two messages, you probably have guessed that I’m out of spare time right now ;)