Introduction: MIDI WOOD

Bonjour la communauté.
Voici mon deuxième clavier MIDI, le premier est ici;)

(Entièrement fabriqué avec du matériel de récupération)

Toujours à la recherche d'authenticité, après le cuivre j'ai travaillé le bois.

Ce clavier MIDI, comme son nom l'indique est fait pour jouer sur "Ableton" ou tout autre logiciel de musique, il est composé de deux octaves (12 notes sans aplat ni aigu) et deux potentiomètres pour cartographier ses fonctions.

L'assemblage électronique est comme tout autre assemblage / bouton - numérique / pot - analogique.

Bouton connecté à la masse puis au PIN numérique de l'Arduino. (Ne mettez pas de résistance, ou dans le code, changez dans la déclaration des broches le "INPUT" au lieu de "INPUT-PULLUP";)

Un grand merci à PretEnGineering pour ses instructions très pratiques lorsque vous commencez comme moi (toute la structure du code est écrite par ces messieurs, je ne l'ai décorée que;)

Bonne chance à tous pour cette période de confinement.

Bonne journée, restez curieux.

Paix

Berru

//////////////////////////////////////////////////// ////////////////////////////CODE///////////////////// //////////////////////////////////////////////////// ///////////////////////

// PENSEZ "PretEnGineering" POUR LA STRUCTURE;)

#comprendre

// # include MIDI_CREATE_DEFAULT_INSTANCE ();

// PIN DE DÉCLARATION NUMÉRIQUE int buttonZpin = 2;

int buttonApin = 3;

int buttonBpin = 4;

int buttonCpin = 5;

int buttonDpin = 6;

int buttonEpin = 7; int buttonFpin = 8; int buttonGpin = 9; int buttonHpin = 10; int buttonIpin = 11; int buttonJpin = 12; int buttonKpin = 13; // PIN DE DÉCLARATION ANALOGIQUE int analogpot1 = A0; // POTARD 1 int analogpot2 = A1; // ROLE DES PIN ANALOGUE int analogpot1Old = 0; int analogpot2Old = 0; int analogpot1New = 0; int analogpot2New = 0; // VALEUR DES PIN ANALOGUE = RECONNU POUR LE MAPPAGE ABLETON COMME "C-54" & "C-55" ETC ... #define analogpotpot1CC 54 #define analogpotpot2CC 55

void setup () {MIDI.begin (); // ETAT DES PIN DIGITAL

pinMode (buttonZpin, INPUT_PULLUP); // UTILISER LA RESISTANCE DE LA CARTE // A ENLEVER SI RESISTANCE // ATTENTION AU CHANGEMENT DE BRANCHEMENT DES BOUTTON !!! pinMode (buttonApin, INPUT_PULLUP); pinMode (buttonBpin, INPUT_PULLUP); pinMode (buttonCpin, INPUT_PULLUP); pinMode (buttonDpin, INPUT_PULLUP); pinMode (buttonEpin, INPUT_PULLUP); pinMode (buttonFpin, INPUT_PULLUP); pinMode (buttonGpin, INPUT_PULLUP); pinMode (buttonHpin, INPUT_PULLUP); pinMode (buttonIpin, INPUT_PULLUP); pinMode (buttonJpin, INPUT_PULLUP); pinMode (buttonKpin, INPUT_PULLUP);

pinMode (analogpot1, INPUT); pinMode (analogpot2, INPUT);

Serial.begin (9600); //////////////////////////////////////////////////// /////// BAULT Serial.begin (115200); }

void loop () {// ETAT ACTUEL DES PIN ANALOGUE static bool buttonZvalueOld = HIGH; bool statique buttonAvalueOld = HIGH; bool statique buttonBvalueOld = HIGH; bool statique buttonCvalueOld = HIGH; bool statique buttonDvalueOld = HIGH; static bool buttonEvalueOld = HIGH; static bool buttonFvalueOld = HIGH; static bool buttonGvalueOld = HIGH; bool statique buttonHvalueOld = HIGH; bool statique buttonIvalueOld = HIGH; bool statique buttonJvalueOld = HIGH; bool statique buttonKvalueOld = HIGH;

bool buttonZvalueNew = digitalRead(buttonZpin); bool buttonAvalueNew = digitalRead(buttonApin); bool buttonBvalueNew = digitalRead(buttonBpin); bool buttonCvalueNew = digitalRead(buttonCpin); bool buttonDvalueNew = digitalRead(buttonDpin); bool buttonEvalueNew = digitalRead(buttonEpin); bool buttonFvalueNew = digitalRead(buttonFpin); bool buttonGvalueNew = digitalRead(buttonGpin); bool buttonHvalueNew = digitalRead(buttonHpin); bool buttonIvalueNew = digitalRead(buttonIpin); bool buttonJvalueNew = digitalRead(buttonJpin); bool buttonKvalueNew = digitalRead(buttonKpin);

////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //NOTE SANS LES DIESES | RANGEE PAR 2 OCTAVES, SOIT LA CAPACIT2 DU CLAVIER MIDI BOIS // // OCTAVE + 28 30 32 33 35 37 39 40 42 44 45 47 48 49 51 FREQUENCES BASSES = NOTES GRAVES // // OCTAVES EN PROG 52,54,56,57,59,61,63,64,66,68,69,71,73,75 // // OCTAVE - 64 66 68 69 71 73 75 76 78 80 81 83 85 87 88 FREQUENCES HAUTES = NOTES AIGUES // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////

if (buttonAvalueNew != buttonAvalueOld){ /////////////////////////////////////////PREMIERE NOTE///////////////////////////////////////////////////////////// if (buttonAvalueNew == LOW){ // SI J APPUIE ...|`||METTRE A L ETAT "HIGH" SI RESISTANCES;) ET ENLEVER INPUT_PULLUP DANS LA DECLARATION MIDI.sendNoteOn(52, 127, 1); // (NUM NOTE,VELOCITE,ETAT?) Serial.println("Note A On"); } else { MIDI.sendNoteOff(52, 0, 1); Serial.println("Note A Off"); } buttonAvalueOld = buttonAvalueNew; }//////////////////////////////////////////////////////////////////////////// B ///////////////////////////////////////////////////////////////////////////////

if (buttonBvalueNew != buttonBvalueOld){ if (buttonBvalueNew == LOW){ MIDI.sendNoteOn(54, 127, 1); Serial.println("Note B On"); } else { MIDI.sendNoteOff(54, 0, 1); Serial.println("Note B Off"); } buttonBvalueOld = buttonBvalueNew; }//////////////////////////////////////////////////////////////////////////// C /////////////////////////////////////////////////////////////////////////

if (buttonCvalueNew != buttonCvalueOld){ if (buttonCvalueNew == LOW){ MIDI.sendNoteOn(56, 127, 1); Serial.println("Note C On"); } else { MIDI.sendNoteOff(56, 0, 1); Serial.println("Note C Off"); } buttonCvalueOld = buttonCvalueNew; }//////////////////////////////////////////////////////////////////////////// D /////////////////////////////////////////////////////////////////////// if (buttonDvalueNew != buttonDvalueOld){ if (buttonDvalueNew == LOW){ MIDI.sendNoteOn(57, 127, 1); Serial.println("Note D On"); } else { MIDI.sendNoteOff(57, 0, 1); Serial.println("Note D Off"); } buttonDvalueOld = buttonDvalueNew; }/////////////////////////////////////////////////////////////////////////// E ///////////////////////////////////////////////////////////////////// if (buttonEvalueNew != buttonEvalueOld){ if (buttonEvalueNew == LOW){ MIDI.sendNoteOn(59, 127, 1); Serial.println("Note E On"); } else { MIDI.sendNoteOff(59, 0, 1); Serial.println("Note E Off"); } buttonEvalueOld = buttonEvalueNew; } ///////////////////////////////////////////52,54,56,57,59,61,63,64,66,68,69,71,73,75//////// F /////////////////////////////////////////////////////////// if (buttonFvalueNew != buttonFvalueOld){ if (buttonFvalueNew == LOW){ MIDI.sendNoteOn(61, 127, 1); Serial.println("Note F On"); } else { MIDI.sendNoteOff(61, 0, 1); Serial.println("Note F Off"); } buttonFvalueOld = buttonFvalueNew; }//////////////////////////////////////////////////////////////////////// G ///////////////////////////////////////////////////////////////////////////

if (buttonGvalueNew != buttonGvalueOld){ if (buttonGvalueNew == LOW){ MIDI.sendNoteOn(63, 127, 1); Serial.println("Note G On"); } else { MIDI.sendNoteOff(63, 0, 1); Serial.println("Note G Off"); } buttonGvalueOld = buttonGvalueNew; }////////////////////////////////////////////////////////////////////////////// H //////////////////////////////////////////////////////////////////////

if (buttonHvalueNew != buttonHvalueOld){ if (buttonHvalueNew == LOW){ MIDI.sendNoteOn(64, 127, 1); Serial.println("Note H On"); } else { MIDI.sendNoteOff(64, 0, 1); Serial.println("Note H Off"); } buttonHvalueOld = buttonHvalueNew; }//////////////////////////////////////////////////////////////////////// I ////////////////////////////////////////////////////////////////////////////// if (buttonIvalueNew != buttonIvalueOld){ if (buttonIvalueNew == LOW){ MIDI.sendNoteOn(66, 127, 1); Serial.println("Note I On"); } else { MIDI.sendNoteOff(66, 0, 1); Serial.println("Note I Off"); } buttonIvalueOld = buttonIvalueNew; }///////////////////////////////////////////////////////////////////// J ///////////////////////////////////////////////////////////////////////////////// if (buttonJvalueNew != buttonJvalueOld){ if (buttonJvalueNew == LOW){ MIDI.sendNoteOn(68, 127, 1); Serial.println("Note J On"); } else { MIDI.sendNoteOff(68, 0, 1); Serial.println("Note J Off"); } buttonJvalueOld = buttonJvalueNew; } //////////////////////////////////////////52,54,56,57,59,61,63,64,66,68,69,71,73,75//// K ////////////////////////////////////////////////////////////////////// if (buttonKvalueNew != buttonKvalueOld){ if (buttonKvalueNew == LOW){ MIDI.sendNoteOn(69, 127, 1); Serial.println("Note K On"); } else { MIDI.sendNoteOff(69, 0, 1); Serial.println("Note K Off"); } buttonKvalueOld = buttonKvalueNew; }/////////////////////////////////////////////////////////////////////// Z //////////////////////////////////////////////////////////////////////////////////// if (buttonZvalueNew != buttonZvalueOld){ if (buttonZvalueNew == LOW){ MIDI.sendNoteOn(50, 127, 1); Serial.println("Note Z On"); } else { MIDI.sendNoteOff(50, 0, 1); Serial.println("Note Z Off"); } buttonZvalueOld = buttonZvalueNew; }///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////-POTARDS-/////////////////////////////////////////////////////////////////////////////////////////////

int pot1 = analogRead(A0); int pot2 = analogRead(A1); int analogpot1New = analogRead(A0); int analogpot2New = analogRead(A1);

if (analogpot1New - analogpot1Old >= 35 || analogpot1Old - analogpot1New >= 35) {//////////////////////// POTARD 1 //////////////////////////////////////// analogpot1Old = analogpot1New; analogpot1New = (map(analogpot1New, 1023, 0, 0, 120)); analogpot1New = (constrain(analogpot1New, 0, 120)); MIDI.sendControlChange(analogpot1CC, analogpot1New, 1); // Serial.print ("pot: "); // Serial.println(pot1); // Serial.print("potread: "); // Serial.println(analogpot1New); } if (analogpot2New - analogpot2Old >= 35 || analogpot2Old - analogpot2New >= 35) {////////////////////// POTARD 2 ///////////////////////////////////////// analogpot2Old = analogpot2New; analogpot2New = (map(analogpot2New, 1023, 0, 0, 120)); analogpot2New = (constrain(analogpot2New, 0, 120)); MIDI.sendControlChange(analogpot2CC, analogpot2New, 1); // Serial.print ("pot: "); // Serial.println(pot2); // Serial.print("potread: "); // Serial.println(analogpot2New); }

retard (25); }

Supplies

La

Step 1: