Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
|
wiki:flossmanuals:table-mixage-images-2:accueil [2021/06/28 15:04] damien.muti [Programmes Arduino] |
wiki:flossmanuals:table-mixage-images-2:accueil [2021/06/30 12:56] (Version actuelle) flora [Réalisation de la maquette et visuels] |
||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | ====== Table de Mixage pour images | + | ====== Table de Mixage pour Glitcher une images ====== |
| * **Porteur(s) du projet** : Flora Vander Poorte (DSAA DG2), Damien MUTI (Prof. de Numérique) | * **Porteur(s) du projet** : Flora Vander Poorte (DSAA DG2), Damien MUTI (Prof. de Numérique) | ||
| Ligne 25: | Ligne 25: | ||
| {{ : | {{ : | ||
| + | |||
| ===== Algorithme ===== | ===== Algorithme ===== | ||
| Ligne 31: | Ligne 32: | ||
| ===== Montage Arduino ===== | ===== Montage Arduino ===== | ||
| ==== Câblage ==== | ==== Câblage ==== | ||
| - | Le montage comportant | + | Le montage comportant |
| ==== Programmes Arduino ==== | ==== Programmes Arduino ==== | ||
| Ligne 37: | Ligne 38: | ||
| Le code permettant de mesurer les valeurs sur les 5 potentiomètres et de les envoyer via le port série est le suivant : | Le code permettant de mesurer les valeurs sur les 5 potentiomètres et de les envoyer via le port série est le suivant : | ||
| - | * {{ : | + | * {{ : |
| < | < | ||
| Ligne 111: | Ligne 112: | ||
| ===== Programme Processing ===== | ===== Programme Processing ===== | ||
| - | Le programme Processing permettant de récupérer les données envoyées par la cartes et de les considérer comme des paramètres permettant | + | Le programme Processing permettant de récupérer les données envoyées par la cartes et de les considérer comme des paramètres permettant |
| + | * {{ : | ||
| - | * | ||
| + | |||
| + | |||
| + | Programme principal : | ||
| < | < | ||
| + | /** Affiche tactile interactive - | ||
| + | | ||
| + | */ | ||
| + | /// librairies | ||
| + | import processing.sound.*; | ||
| + | import processing.video.*; | ||
| + | import processing.serial.*; | ||
| + | |||
| + | // bouton image active ? // est-ce que l' | ||
| + | boolean animation_active = false; // true ou false (2 valleurs possibles) => 1 bit (0 ou 1) | ||
| + | |||
| + | // bouton son actif ? | ||
| + | boolean son_actif = false; | ||
| + | float tempsDebutSon = 0; // temps du début de la musique a été joué | ||
| + | |||
| + | // bouton video active ? | ||
| + | boolean video_active = false; | ||
| + | |||
| + | //potar teinte | ||
| + | int potVal = 0; | ||
| + | int redVal = 0; | ||
| + | |||
| + | |||
| + | /// dialogue avec la carte Arduino | ||
| + | Serial myPort; | ||
| + | int inBuffer; | ||
| + | int donneePortSerie; | ||
| + | |||
| + | // seuil de détection | ||
| + | float seuil = 300; | ||
| + | |||
| + | // port serie | ||
| + | int nCapteurs = 5; | ||
| + | int[] capteurs = new int[nCapteurs]; | ||
| + | int serialCount = 0; // compteur de données reçues | ||
| + | |||
| + | boolean firstContact = false; | ||
| + | // média | ||
| + | int nImages = 3; | ||
| + | String[] nomImages = new String[nImages]; | ||
| + | PImage[] images = new PImage[nImages]; | ||
| + | int nSon = 3; | ||
| + | String[] nomSon=new String[nSon]; | ||
| + | SoundFile[] son; // un son - un seul lecteur CD audio | ||
| + | //Movie vid; // une vidéo - un seul lecteur DVD vidéo | ||
| + | |||
| + | // annim : glitch | ||
| + | PImage imageAffichee, | ||
| + | int mode=0; | ||
| + | Glitch glitch; | ||
| + | |||
| + | // mode debug | ||
| + | boolean debug=true; | ||
| + | |||
| + | |||
| + | void setup() { // initialisation des paramètres d' | ||
| + | size(1000, 800); | ||
| + | noStroke(); | ||
| + | background(0); | ||
| + | colorMode(HSB); | ||
| + | // initialisation des variables globales | ||
| + | // capteurs | ||
| + | for (int i=0; i< | ||
| + | capteurs[i]=0; | ||
| + | } | ||
| + | // nom son | ||
| + | nomSon[0]= " | ||
| + | // | ||
| + | // | ||
| + | // nom images | ||
| + | nomImages[0]= " | ||
| + | nomImages[1]= " | ||
| + | nomImages[2]= " | ||
| + | // images | ||
| + | for (int i=0; i< | ||
| + | images[i]=loadImage(nomImages[i]); | ||
| + | } | ||
| + | // chargement des sons | ||
| + | son =new SoundFile[nCapteurs]; | ||
| + | for (int i=0; i<nSon; i++) { | ||
| + | son[i] = new SoundFile(this, | ||
| + | } | ||
| + | |||
| + | /// Port série | ||
| + | // Print a list of the serial ports, for debugging purposes: | ||
| + | printArray(Serial.list()); | ||
| + | |||
| + | String portName = Serial.list()[2]; | ||
| + | myPort = new Serial(this, | ||
| + | |||
| + | // intstanciation de la classe Glitch | ||
| + | //glitch = new Glitch(); | ||
| + | //glitch = new Glitch(" | ||
| + | imageInitiale = loadImage(" | ||
| + | imageAffichee = imageInitiale.copy(); | ||
| + | glitch = new Glitch(imageAffichee); | ||
| + | } | ||
| + | |||
| + | void draw() { | ||
| + | // chargement des pixels de l' | ||
| + | imageAffichee.loadPixels(); | ||
| + | // | ||
| + | // | ||
| + | ///////////////////////// | ||
| + | // potentiomètres : capteurs[0]-> | ||
| + | |||
| + | // potar 0: teinte | ||
| + | tint(capteurs[0], | ||
| + | |||
| + | |||
| + | // potar 1: glitch | ||
| + | glitch.mode = floor(map(capteurs[1], | ||
| + | if (debug) { | ||
| + | println(" | ||
| + | } | ||
| + | |||
| + | glitch.draw(imageAffichee); | ||
| + | |||
| + | // potar 2: sound | ||
| + | |||
| + | |||
| + | |||
| + | // interactivité liée aux boutons capteurs[3] et capteurs[4] | ||
| + | if (capteurs[3]==255 && !son[0].isPlaying()) { // capteurs[3] ->son | ||
| + | son[0].play(); | ||
| + | } | ||
| + | |||
| + | if (capteurs[4]==255) { // capteurs[4] ->img | ||
| + | for (int i=0; i< | ||
| + | //float x = random(0, images[i].width); | ||
| + | //float y = random(0, images[i].height); | ||
| + | // | ||
| + | float x = random(0, 400); | ||
| + | float y = random(0, 400); | ||
| + | image(images[i], | ||
| + | |||
| + | // enregistrement de l' | ||
| + | |||
| + | |||
| + | | ||
| + | } | ||
| + | imageAffichee.updatePixels(); | ||
| + | } | ||
| + | } | ||
| </ | </ | ||
| + | |||
| + | // | ||
| + | |||
| + | < | ||
| + | void serialEvent(Serial myPort) { | ||
| + | // read a byte from the serial port: | ||
| + | int inByte = myPort.read(); | ||
| + | // if this is the first byte received, and it's an A, | ||
| + | // clear the serial buffer and note that you've | ||
| + | // had first contact from the microcontroller. | ||
| + | // Otherwise, add the incoming byte to the array: | ||
| + | if (firstContact == false) { | ||
| + | if (inByte == ' | ||
| + | myPort.clear(); | ||
| + | firstContact = true; // you've had first contact from the microcontroller | ||
| + | myPort.write(' | ||
| + | println(" | ||
| + | } | ||
| + | } else { | ||
| + | // Add the latest byte from the serial port to array: | ||
| + | capteurs[serialCount] = inByte; | ||
| + | serialCount++; | ||
| + | |||
| + | // If we have nCapteurs=5 bytes: | ||
| + | if (serialCount > nCapteurs-1 ) { | ||
| + | |||
| + | // print the values (for debugging purposes only): | ||
| + | if (debug) { | ||
| + | for (int i =0; i< | ||
| + | print(" | ||
| + | } | ||
| + | println("" | ||
| + | } | ||
| + | | ||
| + | | ||
| + | // Send a capital A to request new sensor readings: | ||
| + | myPort.write(' | ||
| + | // Reset serialCount: | ||
| + | serialCount = 0; | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | |||
| + | Gestion Interactivité : | ||
| + | |||
| + | < | ||
| + | //////////////////////////////////////////////// | ||
| + | void gestionAnimation() { | ||
| + | if (donneePortSerie > 100) { // on appuie sur la touche " | ||
| + | animation_active = true; | ||
| + | } else { | ||
| + | animation_active = false; | ||
| + | } | ||
| + | } | ||
| + | void lancerAnimation() { | ||
| + | float x = 30 + random(-20, 20); // random sur la position | ||
| + | float y = 30 + random(-20, 20); | ||
| + | //image(im, x, y, 200, 200); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Class " | ||
| + | |||
| + | |||
| + | {{ : | ||
| + | |||
| + | |||
| + | < | ||
| + | /** Affiche tactile interactive - | ||
| + | | ||
| + | */ | ||
| + | /// librairies | ||
| + | import processing.sound.*; | ||
| + | import processing.video.*; | ||
| + | import processing.serial.*; | ||
| + | |||
| + | |||
| + | // bouton image active ? // est-ce que l' | ||
| + | boolean animation_active = false; // true ou false (2 valleurs possibles) => 1 bit (0 ou 1) | ||
| + | |||
| + | // bouton son actif ? | ||
| + | boolean son_actif = false; | ||
| + | float tempsDebutSon = 0; // temps du début de la musique a été joué | ||
| + | |||
| + | // bouton video active ? | ||
| + | boolean video_active = false; | ||
| + | |||
| + | //potar teinte | ||
| + | int potVal = 0; | ||
| + | int redVal = 0; | ||
| + | |||
| + | |||
| + | /// dialogue avec la carte Arduino | ||
| + | Serial myPort; | ||
| + | int inBuffer; | ||
| + | int donneePortSerie; | ||
| + | |||
| + | // seuil de détection | ||
| + | float seuil = 300; | ||
| + | |||
| + | // port serie | ||
| + | int nCapteurs = 5; | ||
| + | int[] capteurs = new int[nCapteurs]; | ||
| + | int serialCount = 0; // compteur de données reçues | ||
| + | |||
| + | boolean firstContact = false; | ||
| + | // média | ||
| + | int nImages = 3; | ||
| + | String[] nomImages = new String[nImages]; | ||
| + | PImage[] images = new PImage[nImages]; | ||
| + | int nSon = 3; | ||
| + | String[] nomSon=new String[nSon]; | ||
| + | SoundFile[] son; // un son - un seul lecteur CD audio | ||
| + | //Movie vid; // une vidéo - un seul lecteur DVD vidéo | ||
| + | |||
| + | // annim : glitch | ||
| + | PImage imageAffichee, | ||
| + | int mode=0; | ||
| + | Glitch glitch; | ||
| + | |||
| + | // mode debug | ||
| + | boolean debug=true; | ||
| + | |||
| + | |||
| + | void setup() { // initialisation des paramètres d' | ||
| + | size(1000, 800); | ||
| + | noStroke(); | ||
| + | background(0); | ||
| + | colorMode(HSB); | ||
| + | // initialisation des variables globales | ||
| + | // capteurs | ||
| + | for (int i=0; i< | ||
| + | capteurs[i]=0; | ||
| + | } | ||
| + | // nom son | ||
| + | nomSon[0]= " | ||
| + | // | ||
| + | // | ||
| + | // nom images | ||
| + | nomImages[0]= " | ||
| + | nomImages[1]= " | ||
| + | nomImages[2]= " | ||
| + | // images | ||
| + | for (int i=0; i< | ||
| + | images[i]=loadImage(nomImages[i]); | ||
| + | } | ||
| + | // chargement des sons | ||
| + | son =new SoundFile[nCapteurs]; | ||
| + | for (int i=0; i<nSon; i++) { | ||
| + | son[i] = new SoundFile(this, | ||
| + | } | ||
| + | |||
| + | /// Port série | ||
| + | // Print a list of the serial ports, for debugging purposes: | ||
| + | printArray(Serial.list()); | ||
| + | |||
| + | String portName = Serial.list()[2]; | ||
| + | myPort = new Serial(this, | ||
| + | |||
| + | // intstanciation de la classe Glitch | ||
| + | //glitch = new Glitch(); | ||
| + | //glitch = new Glitch(" | ||
| + | imageInitiale = loadImage(" | ||
| + | imageAffichee = imageInitiale.copy(); | ||
| + | glitch = new Glitch(imageAffichee); | ||
| + | } | ||
| + | |||
| + | void draw() { | ||
| + | // chargement des pixels de l' | ||
| + | imageAffichee.loadPixels(); | ||
| + | // | ||
| + | // | ||
| + | ///////////////////////// | ||
| + | // potentiomètres : capteurs[0]-> | ||
| + | |||
| + | // potar 0: teinte | ||
| + | tint(capteurs[0], | ||
| + | |||
| + | |||
| + | // potar 1: glitch | ||
| + | glitch.mode = floor(map(capteurs[1], | ||
| + | if (debug) { | ||
| + | println(" | ||
| + | } | ||
| + | |||
| + | glitch.draw(imageAffichee); | ||
| + | |||
| + | // potar 2: sound | ||
| + | |||
| + | |||
| + | |||
| + | // interactivité liée aux boutons capteurs[3] et capteurs[4] | ||
| + | if (capteurs[3]==255 && !son[0].isPlaying()) { // capteurs[3] ->son | ||
| + | son[0].play(); | ||
| + | } | ||
| + | |||
| + | if (capteurs[4]==255) { // capteurs[4] ->img | ||
| + | for (int i=0; i< | ||
| + | //float x = random(0, images[i].width); | ||
| + | //float y = random(0, images[i].height); | ||
| + | // | ||
| + | float x = random(0, 400); | ||
| + | float y = random(0, 400); | ||
| + | image(images[i], | ||
| + | |||
| + | // enregistrement de l' | ||
| + | |||
| + | |||
| + | | ||
| + | } | ||
| + | imageAffichee.updatePixels(); | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| ===== Réalisation de la maquette et visuels ===== | ===== Réalisation de la maquette et visuels ===== | ||
| + | {{ : | ||
| + | |||
| + | |||
| + | Pour la maquette, j'ai utilisé une planche de bois MDH 3mm et j'ai fais mon fichier sur AI pour utiliser la découpe laser. | ||
| + | Je me suis servie de ce site qui permet de faire une boîte personnalisée : http:// | ||
| + | Ensuite, j'ai ajouté mon design sur le fichier. | ||
| + | Il faut bien séparer les éléments qu'on veut découper et les éléments qu'on veut graver en deux couleurs distinctes. J'ai fais 2 calques : 1 pour la découpe, 1 autre pour la gravure. | ||
| + | |||
| + | |||
| + | Ci-joint mon fichier en PDF : | ||
| + | |||
| + | {{: | ||
| + | |||
| + | Pour que votre fichier soit valide, referez au fichier exemple de la découpe laser. | ||
| ===== Références : ===== | ===== Références : ===== | ||