Frequency to Colour

These Max/MSP patches take stereo sound and displays 6 blocks of colour corresponding to the fundamental frequency occurring in the sound signal.

Files are here:

In fact, there are 3 blocks for each channel, and the 3 of them should behave in the same manner. However, knowing that there would be a slight difference in calculations, there is a change in colour, and the blocks not always display the same tone.

The sound is read from a file in disc and there is spectrogram on top of the colour squares. To get the frequency of the sound, I used object fzero~, which does a straight forward frequency analysis. It outputs the central frequency of the sound and its amplitude.

With this is just a matter of doing some logic and maths to locate this frequency in the spectrum, and then turn it into RGB values, as follows.

gradient_SpectrumThis is the first part of an intent to control LEDs with sound and create Soundscapes. I am including the patches here, and a short video of the tests.

[vimeo w=500&h=289]