Forums > MaxMSP

Freq to rgb

June 17, 2006 | 2:21 pm

hi all

i’m looking for a simple way to convert a number, representing a frequency, into a list of three numbers, respectively Red Green Blue channel, respecting the correspondances between the audio and the light spectra. I’ve tried with some simple algos but whitout good results.
Do you have any good idea?

cheers

franz


June 17, 2006 | 3:37 pm

Depends on what you mean by good results. You may already be doing this…

If frequency is a single number you can fiddle with it in various ways:
unpack as three numbers using shift and mask
scale the freq differently for each color plane
scale the freq to 0..1 range then scale

This is a basic problem of mapping sound to image and vice versa. A nice
picture doesn’t necessarily make a nice sound. I’ve used MetaSynth a lot
for this but I have to design the image knowing what images make "good"
sounds for me. I have not been satisfied with going from sound to image
although manipulating a sonogram with jitter has produced some things I
really like.

You might also try fiddle~ and its cousins to collect spectral data from
your sound mapping the fundamental and several strong harmonics into RGB.
Envelope following is also useful as an input to the alpha channel.

Cheers,
Gary Lee Nelson
TIMARA Department
Oberlin College
http://www.timara.oberlin.edu/GaryLeeNelson


June 18, 2006 | 4:27 pm

Hello,

there are a few good ideas documented from about 1700-something to today,
but most of them were not based on simple mathematic formula, but rather on
sensibility of particular artist. I like the ones by Oskar Fischinger and
Len Lye, but some people are pleased with mapping of freq to Hue and
amplitude to Brightness or Saturation.

best,
nesa


June 18, 2006 | 11:19 pm

Hello

there is a work group of the AFIM wich works on the Visualisation of sound

http://gtv.mshparisnord.org/en/

I think you will be interested in their work…

Have a good time

antoine


June 19, 2006 | 12:27 am

Hi guys

thank you very much for the precious infos!
The main question didn’t involve any sort of artistic mapping, this will be for sure one of my next steps, but my goal is only to rapresent a frequency from 20 to 18.000hz with a linear colours scale from red to blue or something similar.

E.g.: an higher freq should be positioned in the range of the Blue-Violet if not standing at the synesthetic feels that probably wants to put an higher frequency within the Red range..and so on…
At least i’ve tried simply using the Swatch object and that’s works pretty good for me.

Anyway the link about visualization of sounds shows an amazing project! I have ever been interested in this kind of synesthetic correspondances, from Skrjabin (a semi-scientific approach) and Kandinsky (a total artistic approach to sounds’ visualization) to the contemporary goals on this ground as the mentioned O’Really videos on the Point Line Cloud’s Curtist Roads DVD.
Simply for discussing about it and share a little "OutOfTopic" opinion, i’ve recently seen an exibition by the duo tinylittleelements and i’ve found the video part as a really interesting interpretation of sound.

Hope you can understand my bad bad english!


June 19, 2006 | 8:37 am

Hi

if you only want to map freq to color you can try this (just copy and paste it into a new patcher) :

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 386 251 80 9109513 Jitter visualisation;
#P window setfont "Sans Serif" 36.;
#P comment 365 235 20 9109540 };
#P window setfont "Sans Serif" 9.;
#P newex 237 211 27 9109513 t b l;
#P user jit.pwindow 253 283 82 62 0 1 0 0 1 0;
#P message 254 235 106 9109513 setcell 0 val 0 $1 $2 $3;
#P newex 254 258 98 9109513 jit.matrix foo 4 char 1;
#P comment 59 120 108 9109513 very simple mapping ->;
#P newex 167 91 59 9109513 expr log($i1);
#P number 167 68 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P user panel 167 233 30 30;
#X brgb 0 204 122;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P newex 167 211 65 9109513 prepend brgb;
#P newex 167 119 88 9109513 zmap 2.9 9.9 0 230;
#P user swatch 167 173 128 32;
#P message 167 146 78 9109513 hsl $1 255 128;
#P comment 124 68 41 9109513 freq ->;
#P comment 62 225 80 9109513 Max visualisation;
#P connect 7 0 8 0;
#P connect 8 0 4 0;
#P connect 4 0 2 0;
#P connect 2 0 3 0;
#P connect 3 0 5 0;
#P connect 5 0 6 0;
#P fasten 3 0 13 0 172 208 242 208;
#P connect 13 1 11 0;
#P fasten 13 0 10 0 242 254 259 254;
#P connect 11 0 10 0;
#P connect 10 0 12 0;
#P window clipboard copycount 16;

this is an adaptation of a little patch I made for the automatic determination of color.
and you can get the freq of your sound object with fiddle~ (on MAC) or pitch~ (on PC).

maybe it’s what you need…

antoine

PS : don’t worry about your english, mine is not so good too…


June 19, 2006 | 9:08 am

thank you Antoine! This is exactly the scaling equation i need!
Thank you so much for posting!

franz


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