Idea - Creating an abstraction layer for the Renoise API

I thought about making or suggesting an objective abstraction layer for the Renoise LUA API.

Some examples:

local sendTrack = getTracks().onlySends()["reverb send"]

for track ingetTracks().onlyNormal().each() do
 if (track.name == "sender track") then break end
end

track.getDSPs().onlySends().first().setParameter("send1", sendTrack)
for track in sendTrack.getSources().each() do
 for sendDSP in track.getDSPs().onlySends().each() do
  local wetAmount = sendDSP.getParameter("amount")

 --sendDSP.remove() returns the dsp before
  local newDSP = track.insert(sendTrack.getDSPs().first(), sendDSP.remove())  

  newDSP.setParameter("wet", wetAmount)
 newDSP.setParameter("dry", "100%")
 sendDSP.remove()
 end
 track.remove()
end

I believe such an API would highly improve tool coding.

  • It would avoid breaking compatibility of Renoise features are changed. Only the layer would need to be patched (the layer then should be obligatory)

  • It extremely speeds up coding time and readability.

  • It extremely reduces time in bug fixing.

My questions are:

  1. Is there already such an abstraction layer available?
  2. If not, do you think, this is possible with LUA? I am not such an LUA expert…

What do you think?

I had to create stuff like that by myself.

But very good idea!

Maybe it is a good idea to create a standard lib (which is modular) you can put in your project and remove everything you don’t need.

Here is the functions I had to write :

https://github.com/mrVanDalo/stepp0r/tree/master/src/Objects

In there is for example :

  • instrument fingerprinting

I have done some work on this too.

The project is called xLib, and so far, has been used for powering my xStream tool (which would otherwise be way too complex).

Not really ready for primetime, but the source is on github

https://github.com/renoise/xrnx/tree/master/Tools/com.renoise.xStream.xrnx/source/xLib

@PaloVanDalo: xLib is mainly (but not entirely) composed from static methods - it’s using classes though.

You are obviously an advocate of functional style programming. Any opinion on this choice?

Hey thanks for taking part with your thoughts and sources :slight_smile:

Personally I really prefer that “jquery style” abstraction.

Also nice:

anyObject.data(“keyname”)

anyObject.data(“keyname”, data)

So you can store data along with the object. IMO very logical hehe.

EDIT:

Err, but you can do this already with such object class, no?

anyObject.anyKey

@PaloVanDalo: xLib is mainly (but not entirely) composed from static methods - it’s using classes though.

You are obviously an advocate of functional style programming. Any opinion on this choice?

Well I don’t think it is a good idea to create some functional language layer on top of a language like lua. Lua as imperative language is good.

I would prefer the jquery style, because what I most of the time do is query the states in renoise, and a lot of stuff I do looks like this :

local track = renoise.song().tracks[idx]

if track == nil then return end

local pattern = track.pattern[active_idx]

if pattern == nil then return end

A query language, like jquery, which makes it easy to maneuver and operate on the DOM would make this type of action way easier to read.