   gLastState = state;
   }
 }
+int changeOctave(){
+  buttonState = digitalRead(buttonPin);
+  if (buttonState == HIGH) {
+    return 7;
+  } 
+  else {
+    return 6;
+  }
+}
+
 
 void setup(){
   //Setup encoders' pins
+  pinMode (buttonPin, INPUT);
   pinMode (outputA,INPUT);
   pinMode (outputB,INPUT);
   pinMode (outputC,INPUT);


String notes[] = {"C","C#","D","D#","E","F","F#","G","G#","A","A#","B"};
int stepArr[] = {0,2,4,5,7,9,11,12};
//int keyStep[] = {10, 5, 0, 7, 2, 9, 4};
int update[] = {0,0};
int _note, _key, _range;
int index;
int counterS = 0;
int counterP = 0;
int counterG = 0;

const int outputG = 8;
const int outputH = 9;

// Button
const int buttonPin = 10;
int buttonState = 0;
void noteOn(byte channel, byte pitch, byte velocity) {
  MIDIEvent noteOn = {0x09, 0x90 | channel, pitch, velocity};
  MIDIUSB.write(noteOn);
