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:theremin:accueil [2021/03/25 13:27] damien.muti |
wiki:flossmanuals:theremin:accueil [2021/05/23 19:58] (Version actuelle) flora |
||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | ====== | + | ====== |
- | * Porteur(s) du projet : Flora Van Der Poort (DSAADG2), Damien MUTI (Prof. de Numérique) | + | * Porteur(s) du projet : Flora Vander Poorte |
* Date : 03/2021 | * Date : 03/2021 | ||
* Contexte : Macroprojet | * Contexte : Macroprojet | ||
* Fichiers : | * Fichiers : | ||
- | * | ||
* Liens : | * Liens : | ||
- | * | + | |
- | | + | |
- | * Capteur de distance Ultrasonic Grove (mettre le lien...) | + | |
+ | ---- | ||
- | A remplir... | + | Pour faire un thérémine nous avons besoin de : |
+ | * Carte Arduino Uno | ||
+ | * Cable de branchement usb | ||
+ | * Carte Seeduino | ||
+ | * Capteur Grove Ultrasonic Ranger | ||
+ | * Fils de connexions | ||
+ | |||
+ | Branchement de la carte : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | |||
+ | Nous allons utiliser Arduino et Processing afin de réaliser notre Thérémine. | ||
+ | |||
+ | Pour brancher la carte et commencer le programme, nous allons suivre ce tuto [[http:// | ||
+ | |||
+ | |||
+ | ---- | ||
+ | |||
+ | |||
+ | Faire un Thérémine avec le Leap Motion et Processing | ||
+ | |||
+ | Le programme est assez facile, il faut penser à télécharger les librairies : | ||
+ | - sound | ||
+ | - leap motion | ||
+ | |||
+ | Ce programme permet de faire un thérémine similaire au vrai. Avec la main gauche vous allez pouvoir modifier le volume du son (horizontalement), | ||
+ | |||
+ | |||
+ | ==Voici le programme Processing : | ||
+ | |||
+ | |||
+ | < | ||
+ | // Programme 2021 | ||
+ | |||
+ | import processing.sound.*; | ||
+ | import de.voidplus.leapmotion.*; | ||
+ | |||
+ | LeapMotion leap; | ||
+ | Theremin leapTheremin; | ||
+ | |||
+ | ArrayList< | ||
+ | PVector handPos; // objet position main | ||
+ | |||
+ | TriOsc tri; | ||
+ | |||
+ | void setup () { | ||
+ | |||
+ | size(640, | ||
+ | |||
+ | leap = new LeapMotion(this); | ||
+ | points = new ArrayList< | ||
+ | |||
+ | tri = new TriOsc(this); | ||
+ | |||
+ | leapTheremin = new Theremin(tri); | ||
+ | |||
+ | } | ||
+ | |||
+ | void draw() { | ||
+ | |||
+ | leapTheremin.renderSound(); | ||
+ | |||
+ | for (Hand hand : leap.getHands()) { | ||
+ | |||
+ | handPos = hand.getPosition(); | ||
+ | boolean handIsLeft = hand.isLeft(); | ||
+ | boolean handIsRight = hand.isRight(); | ||
+ | |||
+ | if (handPos.z <= 75) { | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | |||
+ | if (hand.isRight()) { // | ||
+ | leapTheremin.setPitch(); | ||
+ | } | ||
+ | |||
+ | if (hand.isLeft()) { // position de la main gauche | ||
+ | leapTheremin.setVolume(); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | class Theremin { | ||
+ | |||
+ | float freq; | ||
+ | float amp; | ||
+ | int sound; | ||
+ | |||
+ | Theremin (TriOsc tri_g) { | ||
+ | |||
+ | setPitch(); | ||
+ | |||
+ | sound = 1; | ||
+ | |||
+ | tri = tri_g; | ||
+ | |||
+ | } | ||
+ | |||
+ | void setPitch () { | ||
+ | |||
+ | for (int i = points.size()-1; | ||
+ | PVector p = points.get(i); | ||
+ | freq = map((height-handPos.y)+10, | ||
+ | // la couleur s' | ||
+ | |||
+ | } | ||
+ | } | ||
+ | |||
+ | void setVolume() { | ||
+ | |||
+ | for (int i = points.size()-1; | ||
+ | PVector p = points.get(i); | ||
+ | amp = map(width-p.x, | ||
+ | |||
+ | } | ||
+ | } | ||
+ | |||
+ | void renderSound() { | ||
+ | tri.freq(freq); | ||
+ | tri.amp(amp); | ||
+ | tri.play(); | ||
+ | |||
+ | } | ||
+ | } | ||
+ | </ | ||