/**************************************** * Reception des donnees de capteurs * Module 12 entrees analogiques / 16 numeriques vers Midi * Interface-Z * Sensors data reception from * 12 analogical ways / 16 digital ways to Midi *****************************************/ // Importer la library the Midibus // http://smallbutdigital.com/themidibus.php import themidibus.*; MidiBus myBus; void setup() { // Liste des peripheriques Midi disponibles sur l'ordinateur // Displaying Midi devices existing on the computer MidiBus.list(); // Ouverture de port (this, In, Out) // Choisir le numero du peripherique dans la liste // In et Out etant les numeros des peripheriques entrant et sortant // Open Midi port (this, In, Out) // Choose the appropriate Midi device from the list // In and Out being the corresponding In and Out devices myBus = new MidiBus(this, 0, -1); // -1 pour ne pas ouvrir ce port // -1 in order not to open this port } // Reception des capteurs analogiques // Receiving analogical sensors int[] capteur = new int[12]; int numero; void controllerChange(int channel, int number, int value) { // Recoit les messages Midi de type Control Change // Rangement et tri dans un tableau // Receive Control Change messages // Order in an array if ((number >= 32) && (number <= 39)) { numero = number - 32; capteur[numero] = value; } if ((number >= 48) && (number <= 51)) { numero = number - 40; capteur[numero] = value; } println("Control Change : Canal "+channel+" Numero "+number+" Valeur "+capteur[numero]); } // Reception des capteurs tout ou rien // Receiving "all or nothing" sensors int[] num = new int[16]; int pitchoun; void noteOn(int channel, int pitch, int velocity) { // Receive a note On if ((pitch >= 0) && (pitch <=15)) { pitchoun = pitch; num[pitchoun] = velocity; } println("Note On : Channel:"+channel+" Pitch "+pitch+" Velocity "+num[pitchoun]); } void noteOff(int channel, int pitch, int velocity) { // Receive a note Off if ((pitch >= 0) && (pitch <=15)) { pitchoun = pitch; num[pitchoun] = velocity; } println("Note Off : Channel:"+channel+" Pitch "+pitch+" Velocity "+num[pitchoun]); } void draw() { }