New tool (3.1): Always A Free Instrument Slot (Feb 2019)

New alpha:

Mini Helper: Never run out of instrument slots again!

It keeps an eye on the instrument list: When it can`t find an instrument slot with a blank name, it adds a new one for you.

ledger.scripts.AlwaysAFreeInstrumentSlot_V0.54.xrnx (2.2 KB)

menu: Tools:Ledger`s Scripts: Always A Free Instrument Slot

menu becomes ticked when active.


My Other Scripts:


Click For Changelog

v0.54

  • when a slot is deleted and re-added by the tool, the re-added slot remains selected

v 0.53

  • Improved previous fix so that one slot is allowable at the edge case

v 0.52

  • Fixes an edge case where if you deleted all instruments (including a delete operation on slot 1), then loaded a plugin into slot 1, no name notifiers were present to fire and the tool would not work. To deal with this a minimum of two slots will always remain,

v 0.51

  • changed timer to notifiers watching both instrument list and all instrument names
  • added check to prevent exceeding the renoise max instrument count

Do keep in mind that you cannot exceed the instrument limit:

renoise.Song.MAX_NUMBER_OF_INSTRUMENTS

It takes quite a while to hit that, but you should still check for it anyway, just to be safe :slight_smile:

FYI, it would be much better to use the renoise.Instrument.name_observable than a “heavy” timer. A green environment and all that.

Actually it’s really simple, as you only need to hook up all notifiers on init (on instrument list) and then when the instrument list fires an event.type == “remove”, or “insert”. Renoise will auto-destruct observables for whatever instruments that get removed. This would be both lighter and faster than the timer.

It is possible to verify if the instrument has a sample through a _observable, if it is greater than 0:

renoise.song().instruments[].samples[], _observable
print(#renoise.song().selected_instrument.samples)
print(#renoise.song():instrument(ins_idx).samples)

Is there any way to verify by an _observable if there is a plugin loaded inside the instrument?
If this were the case, you could go deeper into this tool, whether or not it includes an instrument name or is empty.

It could be interesting to check if it includes at least one sample and if it has an plugin loaded. Even check the midi section.

Another point. Within main.lua you can sort the functions so that they are all “local”. Although in a small tool does not have much importance.

It seems both setting midi out, loading a vst plugin or adding first sample data will change the instrument name (?). Just observing the name seems good enough imo.

Effectively! It would be useful in case the instrument did not have the empty name but had nothing of samples, plugins or midi data. In fact, the function could select the first instrument with these characteristics. Unless you use the instrument slots to “tag”.

@dblue , yes thanks will add it. Not sure if I should be disappointed with myself for never reaching the limit, or disappointed with renoise for having one!

@joule , yes I took the lazy mans option of the timer :sleeping: , I`ll take a look at the optimisations, thanks for pointers.

@Raul , I don`t think the tool should do any automatic choosing of instruments as primary function. Maybe you want a ‘clear empty instruments with name’ menu? I don’t imagine it’s that common though?

That about doubled the amount of code and complexity but it should be more efficient and snappy now:

v 0.51

  • changed timer to notifiers watching both instrument list and all instrument names
  • added check to prevent exceeding the renoise max instrument count

testing appreciated, may need to reload all tools after re-install.

Turns out it seems to be a problem with u-he Diva VST being deleted.

still treat as alpha though.

v 0.52

Fixes an edge case where if you deleted all instruments (including a delete operation on slot 1), then loaded a plugin into slot 1, no name notifiers were present to fire and the tool would not work. To deal with this a minimum of two slots will always remain,

Maybe I focused it badly. Maybe I thought that the tool would be useful to track the first free slot of instrument, as an additional option. Supposedly, you want to have free slots to enter new instruments. But this approach is a little contradictory to using the slots as simple “tags”.

By the way, I miss a lot of an instrument box with nested folders, even if they are of only one level. They would help a lot with the organization, and it would also be useful to hide / show groups of instruments in a box so small in height. Is it really that complicated to add it under the hood of Renoise?

I think I see what you mean now, so you are saying using empty instrument slots as ‘tags’ i.e. spacers in your instrument list?

Even if the tool scanned the sample data/plugin existence though, then these spacers would still register as empty and a new slot would not be added.

If you use spacers as with text such as --- or ---Bass Instruments--- then the tool simply sees these as used slots and will still add a new slot for later use.

A way around the empty spacer slots would be to simply check the last instrument slot and see if that is empty/ has no name and add a slot only if that is the case. Would that be helpful?

/////////////////////

Edit:

Also updated to 0.53 with an improvement on previous fix.

  • Now one instrument is allowable (and deletable) and tool remains fully functional

v0.54

  • when a slot is deleted and re-added by the tool, the re-added slot remains selected
1 Like