/* jan_falkenberg Farb- und Klanguhr Ich habe mich auf EIN Sinus-Signal beschränkt!("SineWave sin1;") mit passenden Frequenzen und Farbfeldern zu jeder Tageszeit Die Amplitude steigt bis 13:00Uhr an und dann wieder ab im oberen Feld sieht man die Minuten, im unteren die Stunden die Rechtecke in der Mitte zeigen die Sekunden durch steigende und abnehmende Transparenz an. Die Frequenzen steigen synchron zu den Sek. an und ab */ import rwmidi.*; MidiInput input; MidiOutput output; void setup() { MidiOutputDevice devices[] = RWMidi.getOutputDevices(); for (int i = 0; i < devices.length; i++) { println(i + ": " + devices[i].getName()); } input = RWMidi.getInputDevices()[0].createInput(this); output = RWMidi.getOutputDevices()[1].createOutput(); size (500,500); colorMode(HSB, 360, 100, 100, 100); noStroke(); } void draw() { int s = second(); float m = minute(); float h = hour(); float m_color = 0; float h_color = 0; float m_bright=0; float h_bright=0; float m_sat=0; float h_sat=0; float s_trans=0; //Klang float channel=0; float note=0; float velocity=0; channel= map (h,0,23,0,15); //Morgenklang if(h>=4 && h<6){ frameRate(1); if(s<=30) note = map (s,0,30,10,60); if(s>30) note= map (s,30,59,60,10); if(s<=30) velocity= map (s,0,30,0,40); if(s>30) velocity= map (s,30,59,40,0); } if(h>=6 && h<8){ frameRate(1); if(s<=30) note = map (s,0,30,20,75); if(s>30) note= map (s,30,59,75,20); if(s<=30) velocity= map (s,0,30,10,40); if(s>30) velocity= map (s,30,59,40,10); } //Mittagsklang if(h>=8 && h<11){ frameRate(1.5); if(s<=30) note = map (s,0,30,50,85); if(s>30) note= map (s,30,59,85, 50); if(s<=30) velocity= map (s,0,30,20,60); if(s>30) velocity= map (s,30,59,60,20); } if(h>=11 && h<=13){ frameRate(2); if(s<=30) note = map (s,0,30,70,90); if(s>30) note= map (s,30,59,90, 70); if(s<=30) velocity= map (s,0,30,20,65); if(s>30) velocity= map (s,30,59,65,20); } //Nachmittag if(h>13 && h<=16){ frameRate(1); if(s<=30) note = map (s,0,30,40,80); if(s>30) note= map (s,30,59,80,40); if(s<=30) velocity= map (s,0,30,15,50); if(s>30) velocity= map (s,30,59,50,15); } if(h>16 && h<=18){ if(s<=30) note = map (s,0,30,30,70); if(s>30) note= map (s,30,59,70,30); if(s<=30) velocity= map (s,0,30,15,50); if(s>30) velocity= map (s,30,59,50,15); } //Abend if(h>=18 && h<21){ frameRate(1); if(s<=30) note = map (s,0,30,20,60); if(s>30) note= map (s,30,59,20, 60); if(s<=30) velocity= map (s,0,30,10,40); if(s>30) velocity= map (s,30,59,40,10); } //Nacht if(h>=21 && h<=23){ frameRate(1); if(s<=30) note = map (s,0,30,0,30); if(s>30) note= map (s,30,59,30,0); if(s<=30) velocity= map (s,0,30,0,20); if(s>30) velocity= map (s,30,59,20,0); } if(h>=0 && h<5) { frameRate(1); if(s<=30) note = map (s,0,30,0,30); if(s>30) note= map (s,30,59,30, 0); if(s<=30) velocity= map (s,0,30,0,20); if(s>30) velocity= map (s,30,59,20,0); } output.sendNoteOn(1,int(note),int (velocity)); //FARBE if(s<=30) s_trans= map (s,0,30,0,100); if(s>=30) s_trans= map (s,30,59,100,0); //Morgendämmerung if(h>=4 && h<6){ h_color = map(h,4,6,220,258); h_sat= map(h,4,6,56,18); h_bright= map(h,4,6,15,95); m_color = map (m,0,59,220,258); m_bright= map(m,0,59,35,65); m_sat= map(m,0,59,56,18); } //Morgen if(h>=6 && h<8){ h_color = map(h,6,8,31,48 ); h_sat= map(h,6,8,51,10); h_bright= map(h,6,8,95,100); m_color = map(m,0,59,31,48 ); m_sat= map(m,0,59,30,20); m_bright= map(m,0,59,95,100); } //Mittag if(h>=8 && h<13){ h_color = map(h,9,13,191,207 ); h_sat= map(h,9,13,20, 59); h_bright= map(h,10,13,95,100); m_color = map(m,0,59,191,207 ); m_sat= map(m,0,59,18,49); m_bright= map(m,0,59,95,100); } //Nachmittag if(h>=13 && h<18){ h_color = map(h,13,18,207,245 ); h_sat= map(h,13,18, 59,74); h_bright= map(h,13,18,100,40); m_color = map(m,0,59,207,245 ); m_sat= map(m,0,59,49, 35); m_bright= map(m,0,59,100,40); } //Abend if(h>=18 && h<21){ h_color = map(h,18,21,245,276); h_sat= map(h,18,21,74,60); h_bright= map(h,18,21,40,10); m_color = map(m,0,59,245,276 ); m_sat= map(m,0,59,35,49); m_bright= map(m,0,59,60,20); } //bis Mitternacht if(h>=21 && h<=23){ h_color = map(h,21,23,276,249); h_sat= map(h,21,23,60, 40); h_bright= map(h,21,23,15,10); m_color = map(m,0,59,276,249); m_sat= map(m,0,59,60, 40); m_bright= map(m,0,59,15,10); } //Nacht if(h>=0 && h<4){ h_color = map(h,0,5,249, 220); h_sat= map(h,0,5,40, 59); h_bright= map(h,0,5,10,15); m_color = map(m,0,59,249, 220); m_sat= map(m,0,59,40, 59); m_bright= map(m,0,59,10,15); } fill(m_color,m_sat,m_bright); rect(0,0,500,250); fill(h_color,h_sat,h_bright); rect(0,250,500,250); fill(m_color,m_sat,m_bright,s_trans); rect(125,250,250,125); fill(h_color,h_sat,h_bright,s_trans); rect(125,125,250,125); println("stunden"+h); println("minuten"+m); println("sekunden"+s); }