We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSound,  Music Libraries › Map Midi notes to the 7 colours of the spectrum?
Page Index Toggle Pages: 1
Map Midi notes to the 7 colours of the spectrum??? (Read 657 times)
Map Midi notes to the 7 colours of the spectrum???
Mar 9th, 2009, 12:04am
 

Hi, how are you amigos?,
I am working on my 3rd year project, and need to map the 7 mucical notes, with the 7 colors of the spectrum.

I am trying to figure out best way to do it,
I am using HSB color mode.

I need to map for example all D notes with red hue.
there are 0 to 127 midi notes


my question is, just to know how to do a two dimensional array with processing as I am intenting to first define which numbers define which notes and then with the number of the midi note I will be able to know the name of the note, so then assign a hue value.

hope somebody has got some spare time to help me,

best wishes,
Francisco(london).
Re: Map Midi notes to the 7 colours of the spectru
Reply #1 - Mar 9th, 2009, 9:20am
 
just an idea :

int offset=3;//(0 to 12 number) defines the begining of the scale

int colourNumber =  ((noteNumber+offset)%12); // a scale is 12 semitones.

int hue=colourNumber * 127 / 12;

Re: Map Midi notes to the 7 colours of the spectru
Reply #2 - Mar 9th, 2009, 6:44pm
 
hi mots!,

first thanks a lot for your help,

that three lines using modular operantions are very interesting,
I got good results with it.
I will send you the link of my project when finish so you see what you contribute, and i will mention your help with this logarithm you show me.

thanks again,
best wishes!

Page Index Toggle Pages: 1