Project tutorial
Midi Wood Keyboard

Midi Wood Keyboard © LGPL

Clavier Midi avec Mappage sur Ableton;)

  • 250 views
  • 0 comments
  • 1 respect

Components and supplies

About this project

Hi all. I started programming for 2 months and have just finished this second prototype, the first one is here;)

(Entirely manufactured with recovery material)

Still looking for authenticity, after copper I worked wood.

This MIDI keyboard, as its name suggests is made to play on "Ableton" or any other music software, it is composed of two octaves (12 notes without the flat or sharp) and two potentiometers to map its functions, this code allows you to add, note and pot as much as you want.

For your PC and Ableton to recognize the Arduino USB input, it is necessary to install HairLess and LoopBe1.

The electronic assembly is like all other assembly / button - digital / pot - analog.

Button connected to the ground then to the digital PIN of the Arduino. (Do not put resistance, or in the code, change in the declaration of the pins the "INPUT" instead of "INPUT-PULLUP";)

I use a UNO but works with Mega, to add notes (more PIN DIGITAL and ANALOG for the Potentiometer;)

A big thank you to PretEnGineering for its very practical instructions when you start like me (the structure of the code is written by this gentlemen, I have only adapt it to my needs and decorated it;)

Good luck to everyone for this period of confinement.

Nice day, stay curious.

Peace

Berru

Code

Encore un code de clavier midiC#
// 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);
}

Custom parts and enclosures

midi_alpha_berru_face_J907vdkn9H.png
Midi alpha berru face j907vdkn9h
midi_alpha_berru_iCIZTc9rCw.png
Midi alpha berru iciztc9rcw
video-1584886044_QRrkHS0Ndg.mp4
video-1584886044_QRrkHS0Ndg.mp4

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.
90304553 628621817916213 4590903500610732032 n bvx5auz4u1
midi_wood_berru_J56DcE6Eiz.png
Midi wood berru j56dce6eiz

Comments

Similar projects you might like

Arduino + LEDs + MIDI Keyboard + MuseScore = Piano Tutor

Project tutorial by tcucinotta

  • 13,057 views
  • 3 comments
  • 22 respects

Portable MIDI BLE Keyboard

Project showcase by pianodevoyage

  • 5,803 views
  • 2 comments
  • 28 respects

Electronic Piano Keyboard With Preset Songs

Project tutorial by Lindsay Fox

  • 94,196 views
  • 68 comments
  • 190 respects

USB-BLE Wireless MIDI Adapters

Project tutorial by Joe Bowbeer

  • 6,172 views
  • 4 comments
  • 5 respects

Arduino MIDI Stepper Synth

Project tutorial by Jonathan Kayne

  • 24,900 views
  • 23 comments
  • 67 respects

Arduino Keyboard

Project in progress by Gabriele Scordamaglia

  • 14,415 views
  • 17 comments
  • 21 respects
Add projectSign up / Login