Can slice markers be moved with API?

can the API be used to move slicemarkers left&right?

A slice marker is defined by an integer corresponding to its position in the sample. First you get the integer for the marker you want to move by reading it from some_sample.slice_markers, then you can move it using the move_slice_marker function. When in doubt I recommend searching the renoise/definitions repo.

Note: you’ll have to make sure to supply a valid sample frame index as the new position.

1 Like

multiple slice marker move with midi

yep, got it working… it’s pretty nice. what i need to do is increment/decrement them better, and how to detect which slice is selected.

2 Likes

If not already, you should move them relative to the display zoom factor of the sample so that the movement speed stays constant between sample lengths and different zooms.

i’m not sure what in this case would be “relative to display zoom factor of the sample”? i mean, i kinda get what you’re saying, but i’m wondering if you could throw in some math at me that i’d be able to understand. or an example. sorry! i’m a simple guy

Sure, you need to decide on a speed you want to use, for example if you want to move so that 20 moves will take you from the left edge to the right at any zoom level you divide the length of displayed samples by 20 and you move by the amount you get from that.

-- use floor to get an integer
x = math.floor(sample_buffer.display_length / 20)
-- you could also make sure this can never be zero
x = math.max(1, x)