Forums > Jitter

Converting RGB values to Hexadecimal?

May 25 2011 | 10:20 pm

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?

May 26 2011 | 2:21 am

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

-- Pasted Max Patch, click to expand. --

Jun 26 2012 | 1:45 pm

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

Viewing 3 posts - 1 through 3 (of 3 total)

Forums > Jitter