[PD] midi-keyboard display

Mathieu Bouchard matju at sympatico.ca
Tue Feb 22 11:54:20 CET 2005


On Tue, 22 Feb 2005, Orm Finnendahl wrote:

> Nice extensions would be to reflect velocities with shade and display
> different midi channels with different colors, but I could never
> figure out pd's coloring scheme.

It's not too hard, but it's a little annoying to use.

Pd's first colouring scheme is the numbers from 0 to 29 corresponding to
the 30 colours you see in some property dialogs.

The second colouring scheme is more interesting. You have three separate
channels (RGB) and each channel goes from 0 to 63. You multiply them by
(1,64,4096) respectively and you add them. Then, to distinguish them from
the other colouring scheme, you substract that value from -1.

There's an alternate version of the second scheme using values ranging
from 0 to 255 and the constants (1,256,65536); that's 24-bit colour
instead of 18-bit. This one gets used in runtime configuration (sending
"color -256" to a [hsl] makes it turn blue) while the other second scheme
is used in saving colours.

Note that although Pd floats are exactly precise enough for this last
colour system, you can't store those colours as-is in your patch because
the .pd file encoder starts dropping digits at smaller numbers than that
(argh) so you have to save them decomposed and recompute them at load
time.

(now don't ask me why it's like that...)

Things become alot easier once you have an abstraction that does the
computation for you.

_____________________________________________________________________
Mathieu Bouchard -=- Montréal QC Canada -=- http://artengine.ca/matju





More information about the Pd-list mailing list