< Back to IRCAM Forum

Musical Analysis - Note color change systemically based on position or pitch

Hello everyone, in OM7.6, it is possible to change the color of notes in all classes/score objects. I need (for the purposes of musical analysis using OM) a function that allows me to change the color of selected notes systemically based on a) specifying the position (posn-match) or b) specifying the pitch in MIDI cents. At the same time, I need to be able to mark one note or group of notes with one color, another group with another color, etc. The ideal solution would be something like posn-match, where I enter the pitch or position in one slot and the color in another slot, all in a tree list structure. Can you think of a solution?

CODE_color-note.txt (670 Bytes)

I used AI to create the attached code, but it doesn’t work.
Does anyone have any ideas?

Dear Petrh,

Hopefully, AI didn’t yet replace humans :slight_smile:
Here is a solution:

The patch:
Patch 12.omp (8.6 KB)

Best
K

Here a version which automatically include tied notes:
notecolors.zip (3.3 KB)

(unzip then import the folder in the workspace)

Best
K

Thank you very much, Karim! We have met here many times before. I have a question: are the parameters in the Lisp function “om-make-color” in the form of “0.1,” “0.5,” etc. color parameters? Is there some kind of reference colorimetric scale? RGB? But maybe it’s simpler than it looks (sorry, I got up at 5 a.m. today :)). P-

Dear Petr,

The arguments are for RGB colors (Red Green Blue) and values are floats.
where
(om-make-color 1 1 1) is white
and
(om-make-color 0 0 0) is black

all in between is a mix of the three RGB colors

You can look them up in this file:
code/kernel/graphics/graphictools.lisp

Where the code folder is inside the OM app folder (depends if you are on mac, windows or linux). Let me know.

Best
K

Dear Karim, thank you very much for your willingness and help, it works great, have a nice day, P.