Skip to content

Make comparing notes easier #112

Description

@unlessgames

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

context.trigger:is("c4")

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions