Accessing Slice Controls Through Api

I’m trying to find ways to control the Slice Controls and Drumkit mapping following through the API:

I can’t find ways to control the:

  • Toggle for a slice to continue playing the rest of the waveform - Toggle for “Use White Keys Only” - The “starting from the note selected in the value box to the right”

As detailed below in the extracts from the Renoise Docs

Does the API currently allow for controlling these? If so where can I find the documentation on it?

Thanks

Slice Controls

- Toggles whether a slice will continue playing the rest of the waveform once it has reached the end or not.

and

Automatically Assigning Zones to Samples
Pressing the Distribute button in the top right corner of the interface will evenly distribute the number of samples in an instrument across the entire key range.

Just to the left of this, the Drumkit button will assign each sample to a single key, starting from the note selected in the value box to the right. Using the menu button just to the right of the Drumkit button, two additional options can be selected. “Use White Keys Only”, will obviously only assign zones to the white keys, while “First Octave for Transposing” will assign an entire octave to the first sample of the instrument.

The distribute feature is more or less a script itself. If you want to use it, you have to mimic it.
The slice ending behavior has no API connection. AFAIK, every option is sample related (what you can change in the sample properties panel, not in the sample editor)

Thanks, it wasn’t the distribute notes option I was after, more the starting from base note.

For example if I enter the following:

renoise.song().instruments[1].samples[1]:insert_slice_marker(1)
renoise.song().instruments[1].samples[1]:insert_slice_marker(2)
renoise.song().instruments[1].samples[1]:insert_slice_marker(3)

It will insert 3 slices but by default all their key mappings start from C-5 and the slices are on white notes only. What I want it to do is start the key mappings from C-0 and use the black keys and white keys. I can’t seem to find a way to script this and changing the base note on the first sample has no effect.

At the moment, the base note and other properties are read-only when dealing with a sliced instrument, so you will not be able to change these properties directly via scripting. The insert_slice_marker() function will actually use whatever settings you have selected in the Drum Kit options in the Sample Editor.

So if you want your scripted slices to start from C-0 and use both black and white keys, then you simply need to set the appropriate settings in the Drum Kit options. Set your base note there to C-0, and disable the “Use White Keys Only” option. Then your insert_slice_marker() calls will behave as expected.

Yes, it’s a bit weird that everything can’t be scripted through the API right now, but, well, we simply can’t predict everything that everyone will ever want to do :) We can keep this in mind and try to address it in the future, though.

Thanks, that works fine and gives me the behaviour I need, its good enough for personal use anyway although I wouldn’t want to put a tool out there that required the user to ‘manually’ do some steps, I like to try and make things idiot proof as much as I can

That would be great, the more Renoise functions that can be scripted the better IMO, I think sample aliases and slices present some interesting opportunities for scripting, although I wouldn’t say its at the top of my list of must have features right now.
I just figured this would be scriptable so posted here because I thought I might have missed something in the API.

Anyway in this particular case I can achieve the same effect another way as well so all is good. Given how much can already be scripted there are plenty of other ways I can experiment

Cheers

Surely the Ctrl+K keyboard shortcut for inserting a slice should work like this too then?? Currently it always forcing your basenote to C0 and using both black and white keys as far as I can tell. Which obviously has its use, in that you will always have the full range of keys available for slices, which you would not with other settings.

Inserting slices should always work the same, no matter where it is done from. You can not edit Slice positions if made with the keyboard shortcuts, so how come the API allows you to create slice mapping which is impossible from the mouse and keyboard (editing slice positions is disabled in Keymapper)???

It does work the same everywhere.

It doesn’t matter if you manually add slices with keyboard shortcuts, with the mouse, with scripting, or with the automatic slice detector.

Whatever settings you last chose in the generate Drum Kit section in the Sample Keyzones editor, those will be used as the base values when you add the first new slice to a sample.

When you first start a fresh installation of Renoise, the default settings are C-4 base note and using both black and white keys. If you’re getting C-0, then you must have changed it to C-0 at some point in time, so that’s now set as your default.

At the moment the slice markers don’t really receive full keyboard focus, and there’s no key binding to physically move them around yet. It could theoretically be possible with a script, though. You could potentially look at the current cursor/selection position within the sample buffer, and then find the slice marker nearest to that point, and then provide some custom key bindings to move the slice left/right. Could be interesting :)

It doesn’t. :)

Hmm I tested the Ctrl+K multiple times from home last night and it always inserted the slices at C0, no matter what changes I made to the Drum Kit settings.

Have just tested here on the work computer where I have the demo of 2.8.1 installed and it does work as you describe, following the Drum Kit options.

Home: WinXP, 32bit, 2.8.1 registered version, a few tools but can’t remember what.
Work: Win7, 64bit. 2.8.1 demo, no tools at all.

I will double-check at home and try and computer restart if it still doesn’t follow as you have described…

Any reason the drum kit settings are still not available through the API in 3.0???

I just cannot find any reasonable argument, why you would not allow this!

It is so frustrating, every time I get into the scripting, due to the many many “holes” in there. That and the fact that the whole thing breaks backwards compatibility every minor release, making old tools unusable in most cases, until someone finds the time to update them (which of course no one does, because no one expects backwards compatibility to be broken all the time).

I was just now actually about to fix sample chopping into equal slices for you (which really should be native though), but it turns out, I cannot, because without access to the drum kit settings, I will need the user to manually set the starting slice note first, which is just unnecessary…

So unnecessarily frustrating…really…