Thx, I didn't know that object. But the scale you have is backwards. Reverse the values, then the wavelength and the RGB values should match better (see wavelengths/colors listed in my first post). I also like the little part about luminosity that the original author of the code I used threw in, to make infrared and ultraviolet fade out as they leave the range of human vision.
best! D.
Jack wrote:
It doesn't work with [hsv2rgb] ? Have a look to this patch. ++
Jack
Le 13 avr. 09 à 00:12, Derek Holzer a écrit :
Done! Results are attached, with GEM example help patch. Could also be useful for controlling PWM dimmer for RGB lights or LEDs.
best! D.
Derek Holzer wrote:
I also found this: http://www.mail-archive.com/use-revolution@lists.runrev.com/msg17390.html
Which seems much more useful for the task at hand. But not being much pf a C programmer, it could take me some time converting it into a Pd patch. I'll report back... D. Claude Heiland-Allen wrote:
Derek Holzer wrote:
Hey gang,
before I go reinventing somebody else's wheel... has anybody written something that takes a (sound) frequency in Hz or MIDI note and outputs the transposed color in RGB values? Along these lines:
F#44 = 737 nm(Infrared) G 44 = 696 nm(Red) G#44 = 657 nm(Red) A 44 = 620 nm(Red-Orange) A#44 = 585 nm(Yellow) B 44 = 552 nm(Green) C 45 = 521 nm(Green) C#45 = 492 nm(Green-Blue) D 45 = 464 nm(Blue) D#45 = 438 nm(Violet) E 45 = 414 nm(Violet) F 45 = 390 nm(Ultraviolet)
Or even something that takes the light wavelength in nanometers and gives separate RGB values? I'm working on a simple color organ for a friend this week.
http://www.fourmilab.ch/documents/specrend/
Have fun..
-- ::: derek holzer ::: http://blog.myspace.com/macumbista ::: http://www.vimeo.com/macumbista ::: ---Oblique Strategy # 131: "Question the heroic approach" #N canvas 419 47 865 807 10; #X obj 96 49 moses 380; #X obj 147 80 moses 440; #X obj 198 118 moses 490; #X obj 249 149 moses 510; #X obj 300 188 moses 580; #X obj 351 219 moses 645; #X obj 147 188 expr -($f1-440)/(440-380); #X msg 166 207 0; #X msg 186 227 1; #X obj 147 157 t f b b; #X obj 96 72 bang; #X msg 96 118 0; #X msg 126 118 0; #X msg 156 118 0; #X msg 198 299 0; #X msg 237 299 1; #X obj 217 276 expr ($f1-440)/(490-440); #X obj 198 250 t b f b; #X msg 249 359 0; #X msg 268 379 1; #X obj 249 330 t b b f; #X obj 288 358 expr -($f1-510)/(510-490); #X obj 300 379 t f b b; #X msg 319 429 1; #X msg 339 449 0; #X obj 300 410 expr ($f1-510)/(580-510); #X obj 351 476 t b f b; #X msg 351 525 1; #X msg 390 525 0; #X obj 370 502 expr -($f1-645)/(645-580); #X obj 402 248 moses 780; #X obj 402 549 bang; #X msg 402 574 1; #X obj 499 169 moses 380; #X obj 499 192 bang; #X msg 499 217 0; #X obj 652 248 moses 780; #X obj 550 191 moses 419; #X obj 601 219 moses 700; #X obj 550 281 expr 0.3+0.7*($f1-380)/(420-380); #X obj 652 331 expr 0.3+0.7*(780-$f1)/(780-700); #X obj 601 306 bang; #X msg 601 331 1; #X obj 96 25 t f f; #X obj 96 3 inlet wavelength in nm; #X text 829 21 comment; #X text 455 662 Adapted from Monte Goulding's WavelengthToRGB function for libcolor. http://www.mail-archive.com/use-revolution@lists.runrev.com/msg17390.html ; #X text 543 751 derek@umatic.nl; #X obj 96 577 outlet R; #X obj 136 617 outlet G; #X obj 186 657 outlet B; #X obj 499 452 outlet A; #X msg 432 574 0; #X msg 462 574 0; #X connect 0 0 10 0; #X connect 0 1 1 0; #X connect 1 0 9 0; #X connect 1 1 2 0; #X connect 2 0 17 0; #X connect 2 1 3 0; #X connect 3 0 20 0; #X connect 3 1 4 0; #X connect 4 0 22 0; #X connect 4 1 5 0; #X connect 5 0 26 0; #X connect 5 1 30 0; #X connect 6 0 48 0; #X connect 7 0 49 0; #X connect 8 0 50 0; #X connect 9 0 6 0; #X connect 9 1 7 0; #X connect 9 2 8 0; #X connect 10 0 11 0; #X connect 10 0 12 0; #X connect 10 0 13 0; #X connect 11 0 48 0; #X connect 12 0 49 0; #X connect 13 0 50 0; #X connect 14 0 48 0; #X connect 15 0 50 0; #X connect 16 0 49 0; #X connect 17 0 14 0; #X connect 17 1 16 0; #X connect 17 2 15 0; #X connect 18 0 48 0; #X connect 19 0 49 0; #X connect 20 0 18 0; #X connect 20 1 19 0; #X connect 20 2 21 0; #X connect 21 0 50 0; #X connect 22 0 25 0; #X connect 22 1 23 0; #X connect 22 2 24 0; #X connect 23 0 49 0; #X connect 24 0 50 0; #X connect 25 0 48 0; #X connect 26 0 27 0; #X connect 26 1 29 0; #X connect 26 2 28 0; #X connect 27 0 48 0; #X connect 28 0 50 0; #X connect 29 0 49 0; #X connect 30 0 31 0; #X connect 30 1 10 0; #X connect 31 0 32 0; #X connect 31 0 52 0; #X connect 31 0 53 0; #X connect 32 0 48 0; #X connect 33 0 34 0; #X connect 33 1 37 0; #X connect 34 0 35 0; #X connect 35 0 51 0; #X connect 36 0 40 0; #X connect 36 1 34 0; #X connect 37 0 39 0; #X connect 37 1 38 0; #X connect 38 0 41 0; #X connect 38 1 36 0; #X connect 39 0 51 0; #X connect 40 0 51 0; #X connect 41 0 42 0; #X connect 42 0 51 0; #X connect 43 0 0 0; #X connect 43 1 33 0; #X connect 44 0 43 0; #X connect 52 0 49 0; #X connect 53 0 50 0; #N canvas 8 22 664 468 10; #N canvas 0 22 454 304 gemwin 0; #X obj 132 136 gemwin; #X obj 67 89 outlet; #X obj 67 10 inlet; #X obj 67 41 route create; #X msg 67 70 set destroy; #X msg 182 68 set create; #X msg 132 112 create , 1; #X msg 238 112 destroy; #N canvas 87 154 247 179 Gem.init 0; #X obj 59 46 loadbang; #X msg 118 81 reset; #X obj 118 113 outlet; #X obj 59 65 t b b; #X connect 0 0 3 0; #X connect 1 0 2 0; #X connect 3 1 1 0; #X restore 289 80 pd Gem.init; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 3 0 6 0; #X connect 3 1 5 0; #X connect 3 1 7 0; #X connect 4 0 1 0; #X connect 5 0 1 0; #X connect 6 0 0 0; #X connect 7 0 0 0; #X connect 8 0 0 0; #X restore 25 53 pd gemwin; #X msg 25 29 create; #X text 21 9 Create window and render; #X obj 102 190 gemhead; #X obj 102 306 square; #X obj 102 250 colorRGB; #X obj 194 126 hsl 205 15 370 780 0 0 empty empty empty -2 -6 0 10 -262144 -1 -1 20400 1; #X floatatom 219 149 5 0 0 0 - - -; #X obj 102 278 alpha; #X floatatom 191 248 5 0 0 0 - - -; #X floatatom 222 268 5 0 0 0 - - -; #X floatatom 253 288 5 0 0 0 - - -; #X floatatom 152 126 5 0 0 0 - - -; #X floatatom 284 308 5 0 0 0 - - -; #X obj 191 178 WavelengthToRGBA; #X text 190 93 Input range = 380-780 (ultraviolet to infrared wavelengths) ; #X text 464 398 derek@umatic.nl; #X text 343 245 R; #X text 343 265 G; #X text 343 288 B; #X text 343 308 A; #X text 179 329 Convert wavelength in nanometers to colors in RGB. Let the intensity fall off near the limits of vision , as represented by A (Alpha).; #X connect 0 0 1 0; #X connect 1 0 0 0; #X connect 3 0 5 0; #X connect 5 0 8 0; #X connect 6 0 7 0; #X connect 6 0 14 0; #X connect 8 0 4 0; #X connect 12 0 14 0; #X connect 14 0 5 1; #X connect 14 0 9 0; #X connect 14 1 5 2; #X connect 14 1 10 0; #X connect 14 2 5 3; #X connect 14 2 11 0; #X connect 14 3 5 4; #X connect 14 3 13 0; _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list