BERRU
Published © LGPL

Midi Wood Keyboard

Clavier Midi avec Mappage sur Ableton;)

BeginnerFull instructions provided9,812
Midi Wood Keyboard

Things used in this project

Hardware components

Single Turn Potentiometer- 10k ohms
Single Turn Potentiometer- 10k ohms
×2
Tactile Switch, Top Actuated
Tactile Switch, Top Actuated
×12
Arduino UNO
Arduino UNO
×1

Story

Read more

Custom parts and enclosures

midi_alpha_berru_face_J907vdkn9H.png

midi_alpha_berru_iCIZTc9rCw.png

video-1584886044_QRrkHS0Ndg.mp4

boitier final

Ajout d'un ecran lcd.

Test in PCB

Pcb create via easy eda with arduino micro

Schematics

90304553_628621817916213_4590903500610732032_n_BVx5AuZ4U1.jpg

remember to remove the resistors to save. And replace in the declaration of PIN (INPUTPULLUP) by (INPUT) so that the arduino uses the resistance integrated in the card;)
Then connect the buttons to the ground.

midi_wood_berru_J56DcE6Eiz.png

Code

Encore un code de clavier midi

C#
// MAIS CELUI CI CEST LE BON :)
//CODE N°24, CINQUIEME SEMAINE DE PROG 
//THANK "PretEnGineering" POUR LA STRUCTURE ;)
//Beru
#include <MIDI.h>
//#include <pitches.h>
MIDI_CREATE_DEFAULT_INSTANCE(); // DECLARATION PIN DIGITAL
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;
                        //DECLARATION PIN 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 analogpot1CC 54
#define analogpot2CC 55

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

pinMode(buttonZpin, INPUT_PULLUP);// UTILISE 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;
static bool buttonAvalueOld = HIGH;
static bool buttonBvalueOld = HIGH;
static bool buttonCvalueOld = HIGH;
static bool buttonDvalueOld = HIGH;
static bool buttonEvalueOld = HIGH;
static bool buttonFvalueOld = HIGH;
static bool buttonGvalueOld = HIGH;
static bool buttonHvalueOld = HIGH;
static bool buttonIvalueOld = HIGH;
static bool buttonJvalueOld = HIGH;
static bool 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 BRANCHEZ AU GROUND LE BOUTON;) 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); 
    }

delay(25);
}

Credits

BERRU

BERRU

5 projects • 6 followers
Autodidacte

Comments