Ran into this while testing the vars stuff and using trigger in the callback.
Currently it is a bit hard to figure out what trigger.notes[1].key actually is. The docs say it is
key : string | number
Note key & octave string (or MIDI note number as setter)
But there is no way to know from Renoise what it actually is (unless you start from the terminal and use print), is it a number, is it a string, is it "C" or "C4" or "c4" and so on.
The failsafe solution is to do
context.trigger.notes[1].key == note("c4").notes[1].key
Which is kinda unintuitive and boilerplate-y, so maybe it would be useful to have something to make identifying and matching note tables easier. For example the eq operator could work with NoteTables so you could say
context.trigger == note("c4")
Or an is function that would take anything that can be converted into a NoteTable and compare itself to it
Maybe something to be able to just match the key while ignoring the volume and other properties?
context.trigger:has_key("c4")
This could even be smarter like has_key("c") could return true for C on any octave.
Ran into this while testing the vars stuff and using
triggerin the callback.Currently it is a bit hard to figure out what
trigger.notes[1].keyactually is. The docs say it isBut there is no way to know from Renoise what it actually is (unless you start from the terminal and use
print), is it a number, is it a string, is it "C" or "C4" or "c4" and so on.The failsafe solution is to do
Which is kinda unintuitive and boilerplate-y, so maybe it would be useful to have something to make identifying and matching note tables easier. For example the eq operator could work with
NoteTables so you could sayOr an
isfunction that would take anything that can be converted into aNoteTableand compare itself to itMaybe something to be able to just match the key while ignoring the volume and other properties?
This could even be smarter like
has_key("c")could return true for C on any octave.