Wiki

Reso-nance numérique | Arts et cultures libres

Outils du site


projets:malinette-brutbox:accueil

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
projets:malinette-brutbox:accueil [2016/01/15 17:25]
resonance [Firmware Teensy 2]
— (Version actuelle)
Ligne 1: Ligne 1:
-====== Malinette BrutBox ====== 
- 
-{{{project 
-picture:{{:projets:malinette-brutbox:brutbox-phone.jpg|}} 
-contributeurs: BrutPop, Reso-nance   
-description : Pratiques musicales collectives 
-date: 2014-... (en développement) 
-techniques: électronique magnétisme 
-tags: ateliers 
-fichiers: 
-licence: GNUGPL 
-liens: http://brutpop.blogspot.fr 
-}}} 
- 
-{{tag>teensy puredata malinette laser musique ergotherapie}} 
- 
-===== Description ===== 
-Outils pour favoriser la pratique musicale collective, la **BrutBox** permet une approche intuitive et expérimentale du geste et de sa restitution musicale. Le projet est à destination de tous publics, d'encadrement pédagogique ou social. Basée sur le framework développé pour la Malinette, la Brutbox associe du logiciel et une interface permettant la connexion avec une collection non-exhaustive de capteurs. 
- 
-===== Cahier des charges ===== 
-**Janvier 2015** : {{:projets:plugin-dw-fablab:cahierdescharges-2015-01.pdf|}} 
- 
-{{:projets:malinette-brutbox:scenebrutbox.jpg|}} 
- 
-  * Nom : BrutBox ? 
-  * État de l'art : [[http://orguesensoriel.com/|Orgue Sensoriel]]. Refaire sensiblement la même chose en moins cher, en libre/reproductible, (en moins bien ergonomiquement ?) mais en plus intéressant musicalement. Les capteurs sont distingués pour les animateurs : déclencheurs/variateurs, afin qu'ils s'accaparent le dispositif. Notez la taille des capteurs, les couleurs, la fixation, la connectique en Jack et l'utilisation avec 1 seul handicapé et 1 animateur.  
-  * Entrées : kinect, accéleromètre sans fil, neurosky (sans routage), capteur distance, piezo pince, micro, crayon graphite, conductivité corps (genre makey makey), webcam (face tracking, fiducials, ...), gros boutons, pavé XY façon kaospad, tapis XY 
-  * Minimiser le champs d’intervention à un seul capteur. Possibilités de séries de capteurs identiques (ex:touches). 
-  * Interface : patchs musicaux (faible programmation) : Pure Data ou MaxMSP 
-  * Sorties : VST, sortie Midi (vers synthétiseur), 3D (Pure Data) 
-  * Production : Armada 
- 
-==== État de l'art ==== 
-<WRAP group> 
-<WRAP third column> 
-{{:projets:malinette-brutbox:orguesensoriel.jpg|}}\\ 
-//[[http://orguesensoriel.com|Orgue Sensoriel]]// 
-</WRAP> 
- 
-<WRAP third column> 
-{{http://reso-nance.org/malinette/_media/valise-pedagogique-interactive.jpg|}}\\ 
-//[[http://jeromeabel.net/fr/code/valise-pedagogique-interactive|Valise Interactive]]// 
-</WRAP> 
- 
-<WRAP third column> 
-{{:projets:malinette-brutbox:teenage-engineering-oplab.png|}}\\ 
-//[[https://www.youtube.com/playlist?list=PLSM1HuwZomMhqBqJjoRpsohKnESq-q9LJ|OpLab]]// 
-</WRAP> 
- 
-</WRAP> 
- 
- 
- 
- 
-===== Carte et électronique et capteurs ===== 
-==== Carte électronique ==== 
-Nous utilisons pour le moment, la carte Teensy 2.0 qui permet de convertir en MIDI les données de nos capteurs. 
-En guise de connectique nous avons opté pour des connecteurs USB (pour éviter les faux contacts). 
- 
-{{ :projets:malinette-brutbox:screen_shot_05-11-15_at_04.09_pm.png?500 |}} 
-{{:projets:malinette-brutbox:teensy20-usbx8.ai|}} ,{{:projets:malinette-brutbox:teensy20-usbx8.svg|}}  
-{{:projets:malinette-brutbox:teensy-pin-assignments.gif?nolink|teensy pin assignments}} 
-{{:projets:malinette-brutbox:pcb-teensy-usb-implementation.jpg|}} 
- 
- 
- 
-==== Firmware Teensy 2 ==== 
-  * [[.:brutbox-firmware-old:|versions avant 09/06/215]] 
-  * Fichiers : ... 
- 
-Réception des données MIDI à partir de Pure Data 
-{{:projets:malinette-brutbox:pd-brutbox-help.png|} 
- 
-Envoie en 10 bits et réception avec pd avec la boite [<< 7] : 
-<code cpp> 
-int value = 1023; 
-Serial.begin(9600); 
-Serial.println(value >> 7); 
-// ou Serial.println(value & 0x7F); 
-</code> 
- 
- 
-++++ teensy_brutbox.ino (12 ana + encoder,sans on/off, sans capa) | 
-<code cpp> 
-/*  
- * TEENSY 2 for BRUTBOX 
- * Analog sensors + encoder + touch 
- * 
- * Licence : GNU/GPL3 
- * Date : 12/06/2015 
- * Website : http://reso-nance.org/wiki/projets/malinette-brutbox 
- * 
- * Hardware add-on : the MPR121 module for touch sensors 
- * 
- * Midi mapping : 
- * 12 analog sensors (midi controller from 0 to 11) 
- * 1 encoder (midi controller 12) 
- */ 
-  
-// Include libraries 
-#include <Encoder.h> 
-  
-// Midi channel 
-const int channel = 1; 
-  
-// Analog setup 
-int anaPins[] = {22,11,12,13,14,15,16,17,18,19,20,21}; // analog pins 
-const int anaNb = 12; // number of inputs 
-int anaCtl[] = {11,10,9,8,7,6,5,4,3,2,1,0}; // controller in 
-int anaValues[anaNb]; // current analog values 
-int anaLastValues[anaNb]; // previous analog values 
-  
-// Encoder setup 
-Encoder encoderSensor (7, 8); 
-long encoderOldPosition  = -999; 
-long encoderNewPosition; 
-long encoderLastPosition; 
- 
-// Sampling rate 
-elapsedMillis msec = 0; 
-  
-void setup() {  
- 
-  
-void loop() { 
-   if (msec >= 40) { 
-    msec = 0; 
-  
-      // Analog sensors loop 
-      for (int i = 0; i < anaNb; i++) { 
-              anaValues[i] = (int) analogRead(anaPins[i])  / 8 ; 
-              if (anaValues[i] != anaLastValues[i]) {   
-                  usbMIDI.sendControlChange(anaCtl[i], anaValues[i], channel); 
-                  anaLastValues[i] = anaValues[i]; 
-       } 
-       } 
-        
-      // Encoder loop 
-       encoderNewPosition = encoderSensor.read(); 
-       if (encoderNewPosition != encoderOldPosition) { 
-          if (encoderNewPosition > encoderOldPosition) {usbMIDI.sendControlChange(12, 0, channel); 
-          else if (encoderNewPosition < encoderOldPosition) {usbMIDI.sendControlChange(12, 127, channel);} 
-          encoderOldPosition = encoderNewPosition; 
-        }     
-  } 
-  
-  while (usbMIDI.read()) { 
-    // Discard incoming MIDI messages. 
-  } 
-} 
-</code> 
-++++ 
- 
-++++ teensy_brutbox.ino (8 analogique simple , pas de librairie encoder, wire, capacitif...) | 
-<code cpp> 
-// the MIDI channel number to send messages 
-const int channel = 1; 
-  
-// the MIDI continuous controller for each analog input 
-const int controllerA0 = 0; // 10 = pan position 
-const int controllerA1 = 1; // 11 = volume/expression 
-const int controllerA2 = 2; // 91 = reverb level 
-const int controllerA3 = 3; // 93 = chorus level 
-const int controllerA4 = 4; // 93 = chorus level 
-const int controllerA5 = 5; // 93 = chorus level 
-const int controllerA6 = 6; // 10 = pan position 
-const int controllerA7 = 7; // 11 = volume/expression 
-const int controllerA8 = 8; // 91 = reverb level 
-const int controllerA9 = 9; // 93 = chorus level 
-const int controllerA10 = 10; // 93 = chorus level 
-const int controllerA11 = 11; // 93 = chorus level 
- 
-void setup() { 
-} 
-  
-// store previously sent values, to detect changes 
-int previousA0 = -1; 
-int previousA1 = -1; 
-int previousA2 = -1; 
-int previousA3 = -1; 
-int previousA4 = -1; 
-int previousA5 = -1; 
-int previousA6 = -1; 
-int previousA7 = -1; 
-int previousA8 = -1; 
-int previousA9 = -1; 
-int previousA10 = -1; 
-int previousA11 = -1; 
-elapsedMillis msec = 0; 
-  
-void loop() { 
-  // only check the analog inputs 50 times per second, 
-  // to prevent a flood of MIDI messages 
-  if (msec >= 50) { 
-    msec = 0; 
-    int n0 = analogRead(A0) / 8; 
-    int n1 = analogRead(A1) / 8; 
-    int n2 = analogRead(A2) / 8; 
-    int n3 = analogRead(A3) / 8; 
-    int n4 = analogRead(A4) / 8; 
-    int n5 = analogRead(A5) / 8;     
-    int n6 = analogRead(A6) / 8; 
-    int n7 = analogRead(A7) / 8; 
-    int n8 = analogRead(A8) / 8; 
-    int n9 = analogRead(A9) / 8; 
-    int n10 = analogRead(A10) / 8; 
-    int n11 = analogRead(A11) / 8;      
-     
-    // only transmit MIDI messages if analog input changed 
-    if (n0 != previousA0) { 
-      usbMIDI.sendControlChange(controllerA0, n0, channel); 
-      previousA0 = n0; 
-    } 
-    if (n1 != previousA1) { 
-      usbMIDI.sendControlChange(controllerA1, n1, channel); 
-      previousA1 = n1; 
-    } 
-    if (n2 != previousA2) { 
-      usbMIDI.sendControlChange(controllerA2, n2, channel); 
-      previousA2 = n2; 
-    } 
-    if (n3 != previousA3) { 
-      usbMIDI.sendControlChange(controllerA3, n3, channel); 
-      previousA3 = n3; 
-    } 
-    if (n4 != previousA4) { 
-      usbMIDI.sendControlChange(controllerA4, n4, channel); 
-      previousA4 = n4; 
-    } 
-    if (n5 != previousA5) { 
-      usbMIDI.sendControlChange(controllerA5, n5, channel); 
-      previousA5 = n5; 
-    } 
-     
-        if (n6 != previousA6) { 
-      usbMIDI.sendControlChange(controllerA6, n6, channel); 
-      previousA6 = n6; 
-    } 
-    if (n7 != previousA7) { 
-      usbMIDI.sendControlChange(controllerA7, n7, channel); 
-      previousA7 = n7; 
-    } 
-    if (n8 != previousA8) { 
-      usbMIDI.sendControlChange(controllerA8, n8, channel); 
-      previousA8 = n8; 
-    } 
-    if (n9 != previousA9) { 
-      usbMIDI.sendControlChange(controllerA9, n9, channel); 
-      previousA9 = n10; 
-    } 
-    if (n10 != previousA10) { 
-      usbMIDI.sendControlChange(controllerA10, n10, channel); 
-      previousA4 = n10; 
-    } 
-    if (n11 != previousA11) { 
-      usbMIDI.sendControlChange(controllerA11, n11, channel); 
-      previousA11 = n11; 
-    } 
-     
-     
-  } 
-  
-  // MIDI Controllers should discard incoming MIDI messages. 
-  // http://forum.pjrc.com/threads/24179-Teensy-3-Ableton-Analog-CC-causes-midi-crash 
-  while (usbMIDI.read()) { 
-    // ignore incoming messages 
-  } 
-} 
-</code> 
-++++ 
- 
- 
- 
- 
-++++ teensy_brutbox.ino (sans on off pour MAC) | 
-<code cpp> 
-/*  
- * TEENSY 2 for BRUTBOX 
- * Analog sensors + encoder + touch 
- * 
- * Licence : GNU/GPL3 
- * Date : 12/06/2015 
- * Website : http://reso-nance.org/wiki/projets/malinette-brutbox 
- * 
- * Hardware add-on : the MPR121 module for touch sensors 
- * 
- * Midi mapping : 
- * 12 analog sensors (midi controller from 0 to 11) 
- * 1 encoder (midi controller 12) 
- * 12 touch sensors (midi note from 60 to 71) 
- */ 
- 
- 
-// Include libraries 
-#include <Wire.h> 
-#include "Adafruit_MPR121.h" 
-#include <Encoder.h> 
- 
-// Midi channel 
-const int channel = 1; 
- 
-// Analog setup 
-int anaPins[] = {22,11,12,13,14,15,16,17,18,19,20,21}; // analog pins 
-const int anaNb = 12; // number of inputs 
-int anaCtl[] = {11,10,9,8,7,6,5,4,3,2,1,0}; // controller in 
-int anaValues[anaNb]; // current analog values 
-int anaLastValues[anaNb]; // previous analog values 
- 
-// Encoder setup 
-Encoder encoderSensor (7, 8); 
-long encoderOldPosition  = -999; 
-long encoderNewPosition; 
-long encoderLastPosition; 
- 
-// Capacitive Touch MPR121 module 
-// Connection Teensy2  
-// USB wiring : d+ : SDA, d- : SCL, SCL = DO, SDA = D1  
-Adafruit_MPR121 cap = Adafruit_MPR121(); 
-uint16_t lasttouched = 0; 
-uint16_t currtouched = 0; 
-const int touchNb = 12; // number of touch inputs 
-int touchCtl[] = {60,61,62,63,64,65,66,67,68,69,70,71}; // note in 
- 
-// Sampling rate 
-elapsedMillis msec = 0; 
- 
-void setup() {  
-  // Trying to connect to the capacitive module 
-  if (!cap.begin(0x5A)) { 
-    while (1); 
-  } 
-  delay(1000); 
- 
- 
-void loop() { 
-   if (msec >= 20) { 
-    msec = 0; 
- 
-      // Analog sensors loop 
-      for (int i = 0; i < anaNb; i++) { 
-              anaValues[i] = (int) analogRead(anaPins[i])  / 8 ; 
-              if (anaValues[i] != anaLastValues[i]) {   
-                  usbMIDI.sendControlChange(anaCtl[i], anaValues[i], channel); 
-                  anaLastValues[i] = anaValues[i]; 
-       } 
-       } 
-        
-      // Encoder 
-       encoderNewPosition = encoderSensor.read(); 
-       if (encoderNewPosition != encoderOldPosition) { 
-          if (encoderNewPosition > encoderOldPosition) {usbMIDI.sendControlChange(12, 0, channel); 
-          else if (encoderNewPosition < encoderOldPosition) {usbMIDI.sendControlChange(12, 127, channel);} 
-          encoderOldPosition = encoderNewPosition; 
-        }         
-        
-      // Capacitive loop 
-       currtouched = cap.touched(); 
-       for (uint8_t i=0; i < touchNb; i++) { 
-            if ((currtouched & _BV(i)) && !(lasttouched & _BV(i)) ) {usbMIDI.sendNoteOn(touchCtl[i], 127, channel);} 
-            if (!(currtouched & _BV(i)) && (lasttouched & _BV(i)) ) {usbMIDI.sendNoteOn(touchCtl[i], 0, channel);} 
-       } 
-       lasttouched = currtouched; // reset our state 
-  } 
-     
-  while (usbMIDI.read()) { 
-    // Discard incoming MIDI messages. 
-  } 
-} 
-</code> 
-++++ 
- 
-++++ teensy_brutbox.ino (avec on off) | 
-<code cpp> 
-/*  
- * TEENSY 2 for BRUTBOX 
- * Control inputs (sensors) with MIDI messages 
- * 
- * Licence : GNU/GPL3 
- * Date : 11/06/2015 
- * Website : http://reso-nance.org/wiki/projets/malinette-brutbox 
- * 
- * Hardware add-on : the MPR121 module for touch sensors 
- * 
- * Midi mapping : 
- * 12 analog sensors (midi controller from 0 to 11) 
- * 1 encoder (midi controller 12) 
- * 12 touch sensors (midi note from 60 to 71) 
- */ 
- 
- 
-// Include libraries 
-#include <Wire.h> 
-#include "Adafruit_MPR121.h" 
-#include <Encoder.h> 
- 
-// Midi channel 
-const int channel = 1; 
- 
-// Capacitive Touch MPR121 module 
-// Connection Teensy2  
-// USB wiring : d+ : SDA, d- : SCL, SCL = DO, SDA = D1  
-Adafruit_MPR121 cap = Adafruit_MPR121(); 
-uint16_t lasttouched = 0; 
-uint16_t currtouched = 0; 
-const int touchNb = 12; // number of touch inputs 
-const int touchThreshold = 60; 
-int touchStateCtl[] = {40, 41, 42} ; // touch on/off 
-int touchState[touchNb]; // state : on/off 
-//int currentTouchValues[touchNb];  
-//int lastTouchValues[touchNb]; 
-int touchCtl[] = {60,61,62,63,64,65,66,67,68,69,70,71}; // note in 
-int touchOn = 0; 
- 
-// Analog setup 
-int anaPins[] = {22,11,12,13,14,15,16,17,18,19,20,21}; // analog pins 
-const int anaNb = 12; // number of inputs 
-int anaCtl[] = {11,10,9,8,7,6,5,4,3,2,1,0}; // controller in 
-int anaStateCtl[] = {20, 21} ; // sensor on (20), sensor off (21) 
-int anaState[anaNb]; // state : on/off 
-int anaValues[anaNb]; // current analog values 
-int anaLastValues[anaNb]; // previous analog values 
- 
-// Encoder setup 
-Encoder encoderSensor (7, 8); 
-long encoderOldPosition  = -999; 
-long encoderNewPosition; 
-long encoderLastPosition; 
-int encoderStateCtl = 13; // receive ctlout 13 
-int encoderOn = 0; 
- 
-// Sampling rate 
-elapsedMillis msec = 0; 
-int rate = 20; 
- 
-void setup() {  
-  // Midi receive : on/off sensors  
-  usbMIDI.setHandleControlChange(OnControlChange); 
- 
- 
-void loop() { 
-   if (msec >= rate) { 
-    msec = 0; 
- 
-      // Analog sensors loop 
-      for (int i = 0; i < anaNb; i++) { 
-          if(anaState[i] == 1)  { // check first if the sensor is on 
-              anaValues[i] = (int) analogRead(anaPins[i])  / 8 ; 
-              if (anaValues[i] != anaLastValues[i]) {   
-                  usbMIDI.sendControlChange(anaCtl[i], anaValues[i], channel); 
-                  anaLastValues[i] = anaValues[i]; 
-       } 
-          } 
-       } 
-               
-      // Capacitive loop 
-      if(touchOn == 1){ 
-       currtouched = cap.touched(); 
-       for (uint8_t i=0; i < touchNb; i++) { 
-         if(touchState[i] == 1)  { // check first if the sensor is on 
-            if ((currtouched & _BV(i)) && !(lasttouched & _BV(i)) ) { 
-              usbMIDI.sendNoteOn(touchCtl[i], 127, channel); 
-            } 
-            if (!(currtouched & _BV(i)) && (lasttouched & _BV(i)) ) { 
-              usbMIDI.sendNoteOn(touchCtl[i], 0, channel); 
-            } 
-          } 
-        } 
-        lasttouched = currtouched; // reset our state 
-      } 
-           
-     // Encoder 
-     if (encoderOn == 1) { 
-       encoderNewPosition = encoderSensor.read(); 
-       if (encoderNewPosition != encoderOldPosition) { 
-          if (encoderNewPosition > encoderOldPosition) { 
-            usbMIDI.sendControlChange(12, 0, channel); 
-          } else if (encoderNewPosition < encoderOldPosition) { 
-            usbMIDI.sendControlChange(12, 127, channel); 
-          } 
-          encoderOldPosition = encoderNewPosition; 
-          usbMIDI.sendControlChange(12, encoderNewPosition, channel); 
-        } 
-     } 
-  } 
-     
-  while (usbMIDI.read()) { 
-    // Discard incoming MIDI messages. 
-  } 
-} 
- 
-// Receive Midi Control Change 
-void OnControlChange(byte channel, byte control, byte value) { 
-   // Analog sensors on/off 
-   if (control == anaStateCtl[0]) {anaState[-value+(anaNb-1)] = 0;} 
-   else if (control == anaStateCtl[1]) {anaState[-value+(anaNb-1)] = 1;} 
-   else if (control == touchStateCtl[0]) {touchState[value] = 0;} 
-   else if (control == touchStateCtl[1]) {touchState[value] = 1;} 
-   else if (control == touchStateCtl[2]) { 
-     touchOn = value; 
-     if (touchOn == 1) {cap.begin(0x5A);} 
-   } 
-   else if (control == encoderStateCtl) {encoderOn = value;} 
-} 
-</code> 
-++++ 
- 
-++++ teensy-onoff_no-capacitif.ino (cc de 20 à 31 - non attribués / sensor on(46), sensor off(47) ) | 
-<code cpp> 
-// Include libraries 
-#include <Wire.h> 
-//#include "Adafruit_MPR121.h" 
-#include <Encoder.h> 
-  
-// Midi channel 
-const int channel = 1; 
-  
-// Analog setup 
-int anaPins[] = {22,11,12,13,14,15,16,17,18,19,20,21}; // analog pins 
-const int anaNb = 12; // number of inputs 
-int anaCtl[] = {20,21,22,23,24,25,26,27,28,29,30,31}; // cc non-attribués 
-int anaStateCtl[] = {46, 47} ; // sensor on (46), sensor off (47) 
-int anaState[anaNb]; // state : on/off 
-int anaValues[anaNb]; // current analog values 
-int anaLastValues[anaNb]; // previous analog values 
-  
-// Encoder setup 
-Encoder encoderSensor (7, 8); 
-long encoderOldPosition  = -999; 
-long encoderNewPosition; 
-long encoderLastPosition; 
-int encoderStateCtl = 13; // receive ctlout 13 
-int encoderOn = 0; 
-  
-// Sampling rate 
-elapsedMillis msec = 0; 
-int rate = 20; 
-  
-void setup() {  
-  // Midi receive : on/off sensors  
-  usbMIDI.setHandleControlChange(OnControlChange); 
- 
-  
-void loop() { 
-   if (msec >= rate) { 
-    msec = 0; 
-  
-      // Analog sensors loop 
-      for (int i = 0; i < anaNb; i++) { 
-          if(anaState[i] == 1)  { // check first if the sensor is on 
-              anaValues[i] = (int) analogRead(anaPins[i])  / 8 ; 
-              if (anaValues[i] != anaLastValues[i]) {   
-                  usbMIDI.sendControlChange(anaCtl[i], anaValues[i], channel); 
-                  anaLastValues[i] = anaValues[i]; 
-       } 
-          } 
-       } 
- 
-  
-     // Encoder 
-     if (encoderOn == 1) { 
-       encoderNewPosition = encoderSensor.read(); 
-       if (encoderNewPosition != encoderOldPosition) { 
-          if (encoderNewPosition > encoderOldPosition) { 
-            usbMIDI.sendControlChange(12, 0, channel); 
-          } else if (encoderNewPosition < encoderOldPosition) { 
-            usbMIDI.sendControlChange(12, 127, channel); 
-          } 
-          encoderOldPosition = encoderNewPosition; 
-          usbMIDI.sendControlChange(12, encoderNewPosition, channel); 
-        } 
-     } 
-  } 
-  
-  while (usbMIDI.read()) { 
-    // Discard incoming MIDI messages. 
-  } 
-} 
-  
-// Receive Midi Control Change 
-void OnControlChange(byte channel, byte control, byte value) { 
-   // Analog sensors on/off 
-   if (control == anaStateCtl[0]) {anaState[-value+(anaNb-1)] = 0;} 
-   else if (control == anaStateCtl[1]) {anaState[-value+(anaNb-1)] = 1;} 
-   else if (control == encoderStateCtl) {encoderOn = value;} 
-} 
-</code> 
-++++ 
- 
-++++ test-nrpn.ino (sur 1 capteur analo A0) !! mais erreur de compilation… | 
-<code cpp> 
-// Fixed values, for demonstration 
-uint32_t channel = 1;          // channels are 1 to 16 
-uint32_t param = 0;   // your parameter number here, 0 to 16k 
-//uint32_t val = 2;          // your value here, 0 to 16k 
-// in actual use this would come from some physical controller like an analog value 
-// or be computed by monitoring an encoder 
- 
-void sendNRPNHR(uint32_t parameter, uint32_t value, uint32_t channel)  { 
-  // Send an arbitrary 14-bit value to an arbitrary 14-bit non-registered parameter 
-  // Note that param MSB and LSB are shared between RPN and NRPN, so set both at once 
-  // Also, null out the RPN (and NRPN) active parameter (best practice) after data is sent (as it persists) 
- 
-  // Control change 99 for NRPN, MSB of param 
-  usb_midi_write_packed(0xB00B | (((channel - 1) & 0x0F) << 8)  | ((99 & 0x7F) << 16) | ((parameter & 0x7F) << 24)); 
-  // Control change 98 for NRPN, LSB of param 
-  usb_midi_write_packed(0xB00B | (((channel - 1) & 0x0F) << 8)  | ((98 & 0x7F) << 16) | (((parameter >>7) & 0x7F) << 24)); 
-  // Control change 6 for Data Entry MSB of value 
-  usb_midi_write_packed(0xB00B | (((channel - 1) & 0x0F) << 8)  | ((6 & 0x7F) << 16) | ((value & 0x7F) << 24)); 
-  // Control change 38 for Data Entry LSB of param 
-  usb_midi_write_packed(0xB00B | (((channel - 1) & 0x0F) << 8)  | ((38 & 0x7F) << 16) | (((value >>7) & 0x7F) << 24)); 
-  // Now null out active parameter by sending null (127, 0x7F) as MSB and LSB 
-  // Control change 101 for RPN, MSB of param 
-  usb_midi_write_packed(0xB00B | (((channel - 1) & 0x0F) << 8)  | ((101 & 0x7F) << 16) | (0x7F << 24)); 
-  // Control change 100 for NRPN, LSB of param 
-  usb_midi_write_packed(0xB00B | (((channel - 1) & 0x0F) << 8)  | ((100 & 0x7F) << 16) | (0x7F << 24)); 
-} 
- 
- 
-void setup() { 
-} 
- 
-// store previously sent values, to detect changes 
-int previousA0 = -1; 
-elapsedMillis msec = 0; 
- 
-void loop() { 
-  // only check the analog inputs 50 times per second, 
-  // to prevent a flood of MIDI messages 
-  if (msec >= 80) { 
-    msec = 0; 
-    int n0 = analogRead(A0); 
- 
-        if (n0 != previousA0) { 
-         //int valA0 = map(n0, 0, 1023, 0, 16383); 
-         sendNRPNHR(param, n0, 1); // channel 1 
-         previousA0 = n0; 
-        } 
-  } 
-} 
- 
- 
- 
-/////////////////////////////////// LOG ERREURS ////////////////////////////////////////////////////// 
-Arduino : 1.6.7 (Mac OS X), TD: 1.27, Carte : "Teensy 2.0, MIDI, 16 MHz, US English" 
- 
-/Users/zinc5/Documents/Arduino/test-nrpn2/test-nrpn2.ino: In function 'void sendNRPNHR(uint32_t, uint32_t, uint32_t)': 
-/Users/zinc5/Documents/Arduino/test-nrpn2/test-nrpn2.ino:14:83: warning: left shift count >= width of type [enabled by default] 
-usb_midi_write_packed(0xB00B | (((channel - 1) & 0x0F) << 8)  | ((99 & 0x7F) << 16) | ((parameter & 0x7F) << 24)); 
-^ 
-/Users/zinc5/Documents/Arduino/test-nrpn2/test-nrpn2.ino:14:115: error: 'usb_midi_write_packed' was not declared in this scope 
-usb_midi_write_packed(0xB00B | (((channel - 1) & 0x0F) << 8)  | ((99 & 0x7F) << 16) | ((parameter & 0x7F) << 24)); 
-^ 
-/Users/zinc5/Documents/Arduino/test-nrpn2/test-nrpn2.ino:16:83: warning: left shift count >= width of type [enabled by default] 
-usb_midi_write_packed(0xB00B | (((channel - 1) & 0x0F) << 8)  | ((98 & 0x7F) << 16) | (((parameter >>7) & 0x7F) << 24)); 
-^ 
-/Users/zinc5/Documents/Arduino/test-nrpn2/test-nrpn2.ino:18:82: warning: left shift count >= width of type [enabled by default] 
-usb_midi_write_packed(0xB00B | (((channel - 1) & 0x0F) << 8)  | ((6 & 0x7F) << 16) | ((value & 0x7F) << 24)); 
-^ 
-/Users/zinc5/Documents/Arduino/test-nrpn2/test-nrpn2.ino:20:83: warning: left shift count >= width of type [enabled by default] 
-usb_midi_write_packed(0xB00B | (((channel - 1) & 0x0F) << 8)  | ((38 & 0x7F) << 16) | (((value >>7) & 0x7F) << 24)); 
-^ 
-/Users/zinc5/Documents/Arduino/test-nrpn2/test-nrpn2.ino:23:84: warning: left shift count >= width of type [enabled by default] 
-usb_midi_write_packed(0xB00B | (((channel - 1) & 0x0F) << 8)  | ((101 & 0x7F) << 16) | (0x7F << 24)); 
-^ 
-/Users/zinc5/Documents/Arduino/test-nrpn2/test-nrpn2.ino:23:99: warning: left shift count >= width of type [enabled by default] 
-usb_midi_write_packed(0xB00B | (((channel - 1) & 0x0F) << 8)  | ((101 & 0x7F) << 16) | (0x7F << 24)); 
-^ 
-/Users/zinc5/Documents/Arduino/test-nrpn2/test-nrpn2.ino:25:84: warning: left shift count >= width of type [enabled by default] 
-usb_midi_write_packed(0xB00B | (((channel - 1) & 0x0F) << 8)  | ((100 & 0x7F) << 16) | (0x7F << 24)); 
-^ 
-/Users/zinc5/Documents/Arduino/test-nrpn2/test-nrpn2.ino:25:99: warning: left shift count >= width of type [enabled by default] 
-usb_midi_write_packed(0xB00B | (((channel - 1) & 0x0F) << 8)  | ((100 & 0x7F) << 16) | (0x7F << 24)); 
-^ 
-exit status 1 
-Erreur lors de la compilation. 
-</code> 
-++++ 
-==== Capteurs ==== 
-[[.:brouillon-capteurs|Brouillon]] 
- 
-  * Externe : Joystick Thrustmaster® 
-  * Externe : Wiimote® (mac)  >> Voir la page ressource [[materiel:wiimote:accueil|Wiimote]] 
-  * Infrarouge 3/30cm : 1 ana 
-  * infrarouge 20/150cm : 1 ana 
-  * Piezo (plaque) : 1 ana 
-  * Pression carré (plaque) : 1 ana 
-  * Micro electret : 1 ana 
-  * Gros bouton (~buzzer) : 1 ana 
-  * Module Joystick : 2 ana (prise dédiée) 
-  * Accéléromètre ou gyroscope ? : 2 ana (prise dédiée) 
-  * Touch : MPR121 **prises dédiées SCL/SDA - entrées digitales 5 & 6 D0/D1**  
-  * Encodeur potentiomètre (+ robinet ?) : **prises dédiées "INTERRUPTION" - entrées digitales 7 & 8 D2/D3** 
- 
-==== MindWave ==== 
-Nous utilisons un casque Mindwave neurosky pour capter les donnéees (médiation et concentration) d'un utilisateur. 
-Nous utilisons **Processing** qui envoie les données en OSC à PureData (les bibliothèques oscP5 et MindsetProcessing sont nécessaires). 
- 
- 
-++++ Le code pour processing |  
- 
-<code java> 
-import oscP5.*; 
-import netP5.*; 
-import processing.serial.*; 
-import pt.citar.diablu.processing.mindset.*; 
- 
-boolean SEND_OSC = true; 
-String OSC_ADDRESS = "127.0.0.1"; 
-int OSC_PORT = 54321; 
-String SERIAL_PORT = "/dev/tty.MindWaveMobile-DevA"; 
- 
-OscP5 oscP5; 
-NetAddress myRemoteLocation;  
-MindSet mindSet; 
- 
-void setup() { 
-  frameRate(20); 
-  oscP5 = new OscP5(this, 12345); 
-  myRemoteLocation = new NetAddress(OSC_ADDRESS, OSC_PORT); 
-  mindSet = new MindSet(this, SERIAL_PORT); 
-} 
- 
-void draw() {   
-} 
- 
-void exit() { 
-  //println("Exiting"); 
-  mindSet.quit(); 
-  super.exit(); 
-} 
- 
-public void attentionEvent(int attentionLevel) { 
-    OscMessage myMessage = new OscMessage("/mindset/attentionlevel"); 
-    myMessage.add(attentionLevel); 
-    oscP5.send(myMessage, myRemoteLocation); 
-} 
- 
-public void meditationEvent(int meditationLevel) { 
-    OscMessage myMessage = new OscMessage("/mindset/meditationlevel"); 
-    myMessage.add(meditationLevel); 
-    oscP5.send(myMessage, myRemoteLocation); 
-} 
- 
-public void eegEvent(int delta, int theta, int low_alpha, int high_alpha, int low_beta, int high_beta, int low_gamma, int mid_gamma) { 
-    OscMessage myMessage = new OscMessage("/mindset/eeg"); 
-    myMessage.add(delta); 
-    myMessage.add(theta); 
-    myMessage.add(low_alpha); 
-    myMessage.add(high_alpha); 
-    myMessage.add(low_beta); 
-    myMessage.add(high_beta); 
-    myMessage.add(low_gamma); 
-    myMessage.add(mid_gamma); 
-    oscP5.send(myMessage, myRemoteLocation); 
- 
-</code> 
- 
-++++ 
- 
-==== Wiimote ==== 
-Une piste d'utiliser la manette Wiimote pour creer un dispositif ou l'on peut changer de capteur. 
-En démontant le nunchuk et en retirant le joystick nous pouvons utiliser deux entrées analogiques. 
-Attention la wiimote est alimenté en 3.3v, donc nous sommes limité aux capteurs resistifs qui fonctionnent à cette tension. 
- 
-On utilise ensuite OSCULATOR (sur macOS) pour recevoir les données et les transformer en midi. [[materiel:wiimote:accueil|Voir page ressource Wiimote]] 
- 
-{{ :projets:malinette-brutbox:nunchuck_hack.jpg |}} 
-{{ :projets:malinette-brutbox:screen_shot_06-03-15_at_01.21_pm.png |}} 
- 
- 
- 
- 
-===== Logiciel ===== 
- 
-{{ :projets:malinette-brutbox:brutbox_nantes.png?nolink |}} 
-**Dernière version de septembre 2015** (residence à Nantes chez Stereolux) : {{:projets:malinette-brutbox:brutboxx18092015.zip|}} 
- 
-Elle contient une séquence d'une dizaine d'exemples pour quelques heures d'atelier avec différents exercices : voix, effets audio, ondes cérébrale, guitare électronique, loopsampler, capteur lumière et sons binauraux... 
- 
-  * Basé sur la Malinette et Pure Data Extended : https://git.framasoft.org/resonance/malinette/tree/master 
- 
- 
- 
-===== Boite et decoupe laser ===== 
-  * {{:projets:malinette-brutbox:brutbox-proto2.zip|fichiers de découpe des boites et PCB}} 
-  * {{:projets:malinette-brutbox:bb-gaitelyrique.zip|complement CP pour la gaite lyrique}} 
- 
-==== Generateur de boite==== 
-y en a plein… mais celui-ci marche pas mal : http://boxmaker.connectionlab.org 
------- 
-==== Prototype 0.1 ==== 
-  * [[.:pistes:|Pistes initiales]] 
-  * [[.:gantner|Protototype 0.1]] : Espace Gantner 06/03/2015 
- 
-==== Prototype 0.2 ==== 
-**juin 2015 au LFO** : http://piratepad.net/brutbox 
-  * Sélection élargie de capteurs (sensibilités, capacités moteurs) 
-  * Design des capteurs plus gros, plus lourds, codes couleurs pour faciliter la compréhension et le maniement 
-  * Câblages plus longs pour s'installer coinfortablement danss un espace de jeu collectif 
-  * Patchs en forme de pièces musicales préconçues pour //X// capteurs/participants 
- 
- 
  
/home/resonancg/www/wiki/data/attic/projets/malinette-brutbox/accueil.1452875139.txt.gz · Dernière modification: 2016/01/15 17:25 de resonance