Filtering properties for get_all_notes_extended return values is not working
hal bay
Sep 16 2023 | 12:22 pm
From documentation for get_all_notes_extended: "It is possible to optionally provide a single [dict] argument to this function, containing a single key-value pair: the key is "return" and the associated value is a list of the note properties as listed above in the discussion of the returned note dictionaries, e.g. ["note_id", "pitch", "velocity"]. The effect of this will be that the returned note dictionaries will only contain the key-value pairs for the specified properties, which can be useful to improve patch performance when processing large notes dictionaries."
I am trying to make use of new "get_all_notes_extended" function on a clip with notes in it. I want to make use of filtering functionality through dict argument as explained in the docs.
I tried code below:
var filtered_notes = clip.call("get_all_notes_extended", { return: ["note_id", "pitch", "velocity"] });
post("filtered_notes", filtered_notes, "\n");
var notes_raw = clip.call("get_all_notes_extended");
post("notes_raw", notes_raw, "\n");
As seen in the screenshot, "notes_raw" has expected values, however "filtered_notes" is 0.00 for the same clip object. So filtering with dict object with return key, as explained in the docs, is not working for me.
What am I missing here?
Thanks!
Edit: I also tried code below after learning about Dict objects of Max. However, it is still returning all of the keys like notes_raw above, and not filtering anything:
var note_filter = new Dict("note_filter").set("return", ["note_id", "pitch", "velocity"]);
var filtered_notes = clip.call("get_all_notes_extended", note_filter);