Jump to content


Photo

Custom renoise.values example


  • Please log in to reply
10 replies to this topic

#1 joule

joule

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1863 posts
  • Gender:Not Telling

Posted 19 September 2018 - 15:13

Here is a simple principle that can be used for storing custom values inside renoise objects, if your tool needs it. Using the Document API, the values will also be observable, just like most other data accessible in the Song API.

Spoiler


NB1. Doing this per note_column would be more complex, but for something like patterns, tracks or instruments it works really well. These lists are more easy to 'mirror'.
NB2. Do note that it's probably not something you want to do per note_column anyway, as custom properties creates some slight extra overhaul (probably due to native __index metatable stuff)
NB3. It's per session only. Any persistent storage would require something like xml dumping or song comment abuse.

Edited by joule, 19 September 2018 - 15:19.

  • Ledger and Neurogami like this

#2 Neurogami

Neurogami

    Big Super GrandMasta Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPip
  • 779 posts
  • Gender:Male
  • Location:Scottsdale AZ
  • Interests:Art, music, technology

Posted 19 September 2018 - 17:39

Thanks!



#3 joule

joule

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1863 posts
  • Gender:Not Telling

Posted 19 September 2018 - 18:06

NP. Here is an alternative approach (simplified example) if you don't want to affect the global class, but only the particular object(s).
 
local track = renoise.song():track(1)
track.__STRICT = function() return false end
track.my_prop = 10
print(track.my_prop)

Edited by joule, 19 September 2018 - 18:06.


#4 Ledger

Ledger

    Guruh Motha Fakka Knows More About Renoise Than Taktik

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 3660 posts
  • Gender:Male

Posted 19 September 2018 - 21:30

NP. Here is an alternative approach (simplified example) if you don't want to affect the global class, but only the particular object(s).
 

local track = renoise.song():track(1)
track.__STRICT = function() return false end
track.my_prop = 10
print(track.my_prop)

So here you are replacing __STRICT in the new object instance?
 
From just seeing  4Tey`s post here, it`s there to catch undeclared variables. Did you find any consequences/ or things to watch out for with this, since that thread?


Edited by Ledger, 19 September 2018 - 21:42.

  • 4Tey likes this

--> Lua for newbies <--

My Scripts On Forum

Top Tip!

 

cpu : Xeon 1231 v3, os : Win 7 64bit, audio: Audient iD4
posts as 4tune @ KvR and some other music related sites


#5 joule

joule

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1863 posts
  • Gender:Not Telling

Posted 20 September 2018 - 10:26

Did you find any consequences/ or things to watch out for with this, since that thread?

 
Not that I know of. AFAIK, it's only a matter of the __newindex metatable checking if __STRICT is true or not.


  • Ledger and 4Tey like this

#6 darnellisatwork

darnellisatwork

    Member

  • Normal Members
  • PipPip
  • 18 posts

Posted 13 November 2018 - 23:34

I'm sure it's sacrilege to suggest, but has anyone thought of making videos that walk the new guys through the basics of the Renoise APIs in congruence with Lua?


I've actually been making music with Renoise since 2006. 

Unfortunately, I just figured out that Renoise had a forum.

 

Aliases:
DJ DanceAlone (Future-Everything)

                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

                                                                       My Most Recent Remix

 


#7 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1602 posts
  • Gender:Male
  • Location:Spain

Posted 14 November 2018 - 00:32

I'm sure it's sacrilege to suggest, but has anyone thought of making videos that walk the new guys through the basics of the Renoise APIs in congruence with Lua?

 

I came to think about it, but it's a lot of work. There are not many people interested either. If there were 30 people requesting it, maybe there would be videos...


:excl: Development of my tools: Piano Roll EditorKangarooX120SamRenderPhraseTouch

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#8 darnellisatwork

darnellisatwork

    Member

  • Normal Members
  • PipPip
  • 18 posts

Posted 14 November 2018 - 00:39

I mean .... Out of all the people on this forum (assuming that number to be well above 300), there's gotta be at least 30 people who wouldn't mind learning this if they knew the tutorials existed

 

 maybe?    :unsure:  :unsure:  :unsure:  :unsure:  :unsure:  :unsure:


I've actually been making music with Renoise since 2006. 

Unfortunately, I just figured out that Renoise had a forum.

 

Aliases:
DJ DanceAlone (Future-Everything)

                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

                                                                       My Most Recent Remix

 


#9 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1602 posts
  • Gender:Male
  • Location:Spain

Posted 14 November 2018 - 01:04

I mean .... Out of all the people on this forum (assuming that number to be well above 300), there's gotta be at least 30 people who wouldn't mind learning this if they knew the tutorials existed

 

 maybe?    :unsure:  :unsure:  :unsure:  :unsure:  :unsure:  :unsure:

 

I think you're being very optimistic :lol:.


:excl: Development of my tools: Piano Roll EditorKangarooX120SamRenderPhraseTouch

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#10 Neurogami

Neurogami

    Big Super GrandMasta Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPip
  • 779 posts
  • Gender:Male
  • Location:Scottsdale AZ
  • Interests:Art, music, technology

Posted 14 November 2018 - 18:47

I came to think about it, but it's a lot of work. There are not many people interested either. If there were 30 people requesting it, maybe there would be videos...

 

I'd be interested, but I'm more interested in concrete written examples.  As in these posts.   

 

Given something one can cut-n-paste into the developer console, people can see for themselves how it works, and then tweak things to see if they understand what's going on.

 

For example, I was curious about the `track.__STRICT` thing.  My guess was that it was needed in order to allow the addition of custom properties.

 

So I tried an experiement in the console.

 

 

First:

 

 
local _song = renoise.song()
_song.versioned = false
print("Is has this song been versions? " , _song.versioned )

This raises an exception about "versioned"

 

Then

 

 
local _song = renoise.song()
_song.__STRICT = function() return false end
_song.versioned = false
print("Is has this song been versions? " , _song.versioned )

This works, thanks to the override of `__STRICT`

 

And so I learned.

 

 

Question: Is __STRICT built-in to Lua, or is this something coded into Renoise classes to prevent accidentally creating/assigning new properties? 



#11 joule

joule

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1863 posts
  • Gender:Not Telling

Posted 14 November 2018 - 18:52

Afaik it's just a function that's checked in the __newindex metamethod of the objects. If the metamethod is put there by luabind/some_library or by taktik I don't know, but I think luabind.