Chop Suey: Breakchopping With Style

hey everyone, i made something for you. just a couple hours’ work…never worked with lua before, was a nice learning experience.

by now you’re duly familiar with the age-old process of slicing up breaks or other drum samples: select, cut, new sample, paste, select, cut, new sample…
chop suey simplifies the process! the above process becomes: select, selection to new sample, select, selection to new sample…
much nicer, trust me!

exposes two ways of calling this: a menu in the sample editor and a keybinding (search for “chop suey” in the bindings window).
you’ve still gotta do the “generate drumkit” at the end, but i’d like to have that step be automatic in the future.

the calculations here should be correct…the lua 1-index vs. renoise-and-everything-else 0-index bit threw me for a loop, so i might be miscalculating something somewhere, but i’ve tested it and it shouldn’t throw errors. doesn’t handle loops or anything like that yet (soon, soon).

go crazy, y’all. let me know.

also, hey taktik:
the keybinding isn’t saving, is something up?
additionally, could you add in a function for getting the position of the…I don’t know what to call it, the playhead in the sample editor?

There also is a copy into new sample command in the sample editor?

But if chop suey would automatically find the to be chopped slices, that would be cool!

If your script fails to load once (which easily happens while developing), keybindings won’t apply, and will get removed. So thats just a developers problem.

Why would you need that here?

I think he meant the edit cursor? The dotted line, that appears when you click on some place in the sample. Am I correct?

IC. Thats a selection with no size.

some small tips to help you getting into Lua:

local i  
for _,i in pairs(to_copy) do new[i] = smp[i] end  

“i” gets defined automatically as local variable in the loop. you only would need to declare it outside of the loop if you need to access it outside of the loop.

I know that some of our “example” tools do it like this. We should remove/fix this to avoid confusion.

ins.insert_sample_at(ins, smpidx + 1)  
-- is the same as:  
ins:insert_sample_at(smpidx + 1)  

And counting from 1 takes a day or two to get used to, but it really makes sense. Don’t worry. You’ll get used to it ;)

this is a nice tool for sure,but i think its faster to use the copy to new sample,its just rightclick on the selection and thats it

yeah, there is. chop suey is basically “cut into new sample, then show new sample”. just removes a few steps, especially if you’ve got it mapped to a key.

i think this is pretty much what I’m doing!
edit: no it’s not!

yes, that! so that you could just move the edit cursor somewhere and cut from the edit cursor to the end (or beginning) into a new sample.

thanks for the tips too, taktik! it was pretty late and I was mostly just concerned with getting something working.