Forums > MaxMSP

patch for pitch to color

April 5, 2014 | 12:54 pm

hi all, as a jackaroo I’m looking for a patch which can pick a color based on incoming sound pitch (voice). I there anybody who can help me? thnx


April 5, 2014 | 1:55 pm

Pitch and beat detection aren’t necessarily trivial. A voice isn’t just a "a pitch". It’s more complex. Your sound source will influence your method. Search the forum for different approaches.

Once you have actual pitch data (frequency values, MIDI notes, etc), you can choose how to map the values to color. In general, you are probably best sticking with a hue-based color space like HSL, HSV, etc. because the variables are more analogous to sound. One of the more common ways is to scale the 12 semitones to 360 degrees of hue. You can also map amplitude to lightness or duration to saturation. Things like that.


April 5, 2014 | 2:02 pm

thnx for your reply.. I was thinking of fiddle…but I like your ‘simple’ idea.. [though even that's kind of complicated for me:-p]


April 5, 2014 | 2:13 pm

Once you get your sound source / pitch detection thing figured out, post a patch and I will help you turn the data to color. Good luck with your project.


April 5, 2014 | 2:15 pm

really? great thanks in advance..


April 5, 2014 | 2:42 pm

this what I’ve got so far..


April 5, 2014 | 5:29 pm

Here is something that uses pitch~ to convert input tones to color. Specifically, frequency to hue and amplitude to value. Frequency changes the "color" and gain control the overall "brightness" or value of the color.

Hue is polar and measured in degrees.. so you need to set a frequency range to map to 0-360.

Using cycle~ as a source makes it a bit clearer to illustrate. You can always plug in a different sound source.

Also, this patch uses a jasch object (hsv2rgb), so you’ll need to grab that library if you don’t have it. Otherwise, I can post an hsv2rgb abstraction built with max objects as an alternative.

– Pasted Max Patch, click to expand. –

April 6, 2014 | 12:04 am

wow that’s really great! thanks very much.
I’m trying to figure out about the hsv2rgb thingy.. If understand it right: it’s a small piece that arranges HSV to RGB. I found it on jash-downloads and I installed it in max/file/install (hope this is right)
anyway great thanks to you Metamax. but if I run into problems with this project can I ask you again?


April 6, 2014 | 3:17 am

Yeah, it takes hue, saturation and value and converts them to red, green and blue.

http://en.wikipedia.org/wiki/HSL_and_HSV

The benefit of using HSV or HSL colorspace is that it puts all of the hue info into one channel (rather than needing 3 as with RGB) and it allows you to control brightness and colorfulness separately.


April 6, 2014 | 3:38 am

Oh and yeah, I’ll help you out. But you will learn more if you do it yourself. Sometimes you just have to sit with it.. until your brain hurts.


April 6, 2014 | 4:37 am

yeah right! You gave me a good start though. I’m working with the patch right now, and trying to understand it better. Anyway, thanks again for your help and when I get this project working I’ll post it to you.
cheers!


April 7, 2014 | 11:31 am

Hi there again, I almost got it.. do you have for me [pitch~ 2048 512 4096 blackman72 0 1 10 3] or is it just the pitch~ object?


April 7, 2014 | 11:45 am

Not sure I understand your question. You included the pitch~ object in your original patch. That’s why I used it. It’s a CNMAT external. Everything after the ~ is an argument.


April 7, 2014 | 12:17 pm

never mind.. got it!!


April 7, 2014 | 10:23 pm

I promised to post the patch for my installation so here it is.. It just needs some minor justifications
many thanks for your contribution!


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