Converting RGB values to Hexadecimal?

May 25, 2011 at 10:20pm

Converting RGB values to Hexadecimal?

I am working on a patch to control a string of RGB LEDs via music input. Currently I have been able to use a filter bank to generate R G B values (either on a scale of 0 to 255 or 0 to 1.0) from a color look-up table. I am having trouble figuring out how to convert these values to hex format for output to the LEDs though. I have found several javascript examples, but haven’t been able to get them to work within a Max patch, anybody know how to do this?

#57296
May 26, 2011 at 2:21am

You can use the Lhex object along with the regexp in the patch below:

http://www.maxobjects.com/?v=objects&id_objet=1070&requested=hex&operateur=AND&id_plateforme=0&id_format=0

ftp://arts.ucsc.edu/pub/ems/Lobjects/

– Pasted Max Patch, click to expand. –
#205264
Jun 26, 2012 at 1:45pm

I wanted to be able to do this without installing any externals. An alternative is to feed number boxes into [sprintf]. To get HTML color codes, for example, use

sprintf #%x%x%x

#205265

You must be logged in to reply to this topic.