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 & HelpOther Libraries › MidiClock 2 OSC Tool, problem
Page Index Toggle Pages: 1
MidiClock 2 OSC Tool, problem (Read 1445 times)
MidiClock 2 OSC Tool, problem
Oct 5th, 2009, 12:55pm
 
hi,

ich hoffe hier kann jemand Deutsch Smiley
habe mir ein kleines Tool gebastelt, dieses funktioniert auch gut.
Aber, es dauert ewig bis es startet, und bis änderungen der radio-buttons & der multiList übernommen werden.

kurze Erklärung was das Tool macht: es wandelt MidiClock in ein Beat-Signal um das über OSC gesendet wird. Grin

import controlP5.*;
import promidi.*;
import themidibus.*;
import javax.sound.midi.MidiMessage;
import oscP5.*;
import netP5.*;

MidiBus myBus;
ControlP5 controlP5;
MultiList l;
MidiIO midiIO;
ControlTimer o;
OscP5 oscP5;
NetAddress myBroadcastLocation;

float eRadius;
int x;
float w ;
float q;
float s;
float t;

int h=(24);
int i=(1);
int a=(2);
int BPM;
long p=500;
int e;
int r;
int r2;
int r3;
int d;
int f;


void setup() {
 size(400,200);
 background(0);
 //smooth();
 frameRate(25);
 o = new ControlTimer();
 o.setSpeedOfTime(1);
 oscP5 = new OscP5(this,12000);
 myBroadcastLocation = new NetAddress("127.0.0.1",12000);
 PFont fontB = loadFont("Georgia-Bold-48.vlw");
 textFont(fontB, 15);
 ellipseMode(CENTER_RADIUS);
 eRadius = 20;
 controlP5 = new ControlP5(this);
 midiIO = MidiIO.getInstance(this);
 MidiBus.list();
 myBus = new MidiBus(this);
 Radio r = controlP5.addRadio("radio",10,60);

 r.add("x4",0);
 r.add("x2",1);
 r.add("x1",2);
 r.add("x0,5",3);
 r.add("x0,25",4);
 r.setColorActive(color(128,0,128));
 r.activate("x1");
 MultiList l = controlP5.addMultiList("myList",0,20,175,12);
 MultiListButton b;
 b = l.add("Midi Inputs",1);
 for(int i=0;i<midiIO.numberOfInputDevices();i++) {
   MultiListButton c = b.add("Midi Input",20+i+1);
   c.setLabel((i+1)+" "+midiIO.getInputDeviceName(i));
   c.setColorBackground(color(128 + 18*i,0,0));
   c.setColorActive(color(128,128,0));
 }
}



void draw() {
 background(0);
 fill(255);
 text("Maik MidiClock 2 OSC Tool Vers.1.1",50, 15);
 text(p+" msec",10, 50);
 text((60000/p)+" BPM",320, 50);
 float a = map(eRadius, 20, 80, 60, 255);
 fill(60, 255, 0, a);
 ellipse(width/2, height/2, eRadius, eRadius);
 eRadius *= 0.5;
 if ( eRadius < 20 ){
   eRadius = 20;
 }

}
void radio(int g) {
 switch(g) {
   case(0):
   h=(6);    
   break;  
   case(1):
   h=(12);
   break;  
   case(2):
   h=(24);
   break;  
   case(3):
   h=(48);
   break;  
   case(4):
   h=(96);
   break;
 }


}
void controlEvent(ControlEvent theEvent) {

 println(theEvent.controller().name()+" = "+theEvent.value());  
 if (theEvent.controller().name()== "Midi Input" ){

   w = (theEvent.value()-21.0);
 }

 if (theEvent.controller().name()== "Midi Inputs" )
 {

   myBus.clearInputs();
   w = -1;
 }

 e = int(w);

 myBus.clearInputs();
 myBus.addInput(e);


}
void midiMessage(MidiMessage message) {

 if (message.getStatus()==248){
   x= x+1;
 }
 if (x==h){
   x=0;
   eRadius = 80;
   p=(o.time());
   OscMessage myOscMessage = new OscMessage("/Traktor.Deck1.Beat");
   myOscMessage.add(1.0);
   oscP5.send(myOscMessage, myBroadcastLocation);
   o.reset();
 }


 if (x>h){
   x=0;
 }


}



es scheint am controlP5 zu liegen, dort hängt es am Anfang.

mfg Maik
Re: MidiClock 2 OSC Tool, problem
Reply #1 - Feb 8th, 2010, 2:36pm
 
see what your trying to do.

don't use the midi clock. use the beat phase output in Traktor over a standard midi channel. Use midibus examples to pick up the message params and funk it up in processing...

Looked like fun, so i had a go.

youtube vid of it all working at wilksycom youtube channel

iphone vid...so a bit crappy

i see i Traktor dancing monkey being built soon....
Re: MidiClock 2 OSC Tool, problem
Reply #2 - Feb 8th, 2010, 2:37pm
 
http://www.youtube.com/watch?v=zK-2eelTSDg


sorry...
Page Index Toggle Pages: 1