Final Project Documentation: Leo Shirky

Project Idea:

I wanted to use the instrument that Gopika and I made for one of the earlier assignments in a creative way. Given that I had an instrument that people could play, I decided to make a project where people could choose a song that they wanted to hear, and then play that song on the instrument.

I had originally planned to have the only sound come from the Piezo buzzer, however the Professor told me about a program called Sforzando, which is a software which allows the sound of musical instruments to be played from a computer. I coded four songs that I wanted to be played from the computer in Processing, and connected that to Sforzando, allowing the songs to sound much better than if they had been played on the Piezo buzzer.

The serial communication happened between Processing and Arduino by lighting up LEDs depending on which note was being played in each song. These LEDs also lit up when a note was played on the instrument. The instrument itself used an Ultrasonic Distance Sensor, and had 10cm ranges that mapped on to a specific note, which would then be played from the Piezo buzzer.

Videos:

Reflections:

There were some aspects of the project that I wish I could have improved, but either didn’t have the time or the knowledge to.

The first is that I would have requested to use speakers, rather than my computer speakers. I hadn’t taken into account that the ambient noise of the show would drown out even the loudest volume on my computer, which had always been too loud in tests. The result was that it could be hard to pick out the melody that was being played from the computer.

I wanted to play instrument through Sforzando rather than the Piezo buzzer, as the buzzer doesn’t sound as good and was quieter than the computer speakers. Unfortunately, despite spending hours trying to figure it out, I just couldn’t get this type of serial communication to work in this direction. I had to settle for the buzzer in order to finish the rest of the project in time for the show.

The last major improvement would have been to have multiple octaves, rather than just one. Unfortunately this would have required more space and would have been inconvenient to play, so I settled on just the one octave. I also couldn’t add flat or sharp notes, as I had a limited amount of space and decreasing the distance that counts as a note below about 10 cm makes the instrument much harder to play.

Code:

Arduino:

#define echoPinC 12
#define trigPinC 11

#include "pitches.h"

String notes[7] = {"C4", "D4", "E4", "F4", "G4", "A4", "B4"};

int notesH[7] = {NOTE_C4, NOTE_D4, NOTE_E4, NOTE_F4, NOTE_G4, NOTE_A4, NOTE_B4};

long durationC;
int distanceC;

int bNote = 0;
int aNote = 0;
int gNote = 0;
int fNote = 0;
int eNote = 0;
int dNote = 0;
int cNote = 0;

void setup() {
  Serial.begin(9600);
  Serial.println("0,0");
  pinMode(8, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(2, OUTPUT);

//USDS code
  pinMode(trigPinC, OUTPUT);
  pinMode(echoPinC, INPUT);
}

void loop() {
//USDS Code
  digitalWrite(trigPinC, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPinC, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPinC, LOW);
  durationC = pulseIn(echoPinC, HIGH);
  distanceC = durationC * 0.034 / 2; 

  Serial.println("DistanceC: ");
  Serial.print(distanceC);
  Serial.print(" cm");
  Serial.print("mapped: ");

  int constrainedInput=constrain(distanceC, 1, 70);
  int mappedNote=map(constrainedInput, 1, 70, 0, 6);
  Serial.println(notes[mappedNote]);

  if(distanceC < 80){
    tone(10, notesH[mappedNote]);
  }else{
    noTone(10);
  }
    if(distanceC > 80){
    noTone(10);
  }
  if(mappedNote == 0){
    digitalWrite(2, HIGH);
  }else{
    digitalWrite(2, LOW);
  }
  if(mappedNote == 1){
    digitalWrite(3, HIGH);
  }else{
    digitalWrite(3, LOW);
  }
  if(mappedNote == 2){
    digitalWrite(4, HIGH);
  }else{
    digitalWrite(4, LOW);
  }
  if(mappedNote == 3){
    digitalWrite(5, HIGH);
  }else{
    digitalWrite(5, LOW);
  }
  if(mappedNote == 4){
    digitalWrite(6, HIGH);
  }else{
    digitalWrite(6, LOW);
  }
  if(mappedNote == 5){
    digitalWrite(7, HIGH);
  }else{
    digitalWrite(7, LOW);
  }
  if(mappedNote == 6){
    digitalWrite(8, HIGH);
  }else{
    digitalWrite(8, LOW);
  }
  if(distanceC > 80){
    digitalWrite(8, LOW);
  }

    while (Serial.available()) {
    bNote = Serial.parseInt();
    aNote = Serial.parseInt();
    gNote = Serial.parseInt();
    fNote = Serial.parseInt();
    eNote = Serial.parseInt();
    dNote = Serial.parseInt();
    cNote = Serial.parseInt();
    if (Serial.read() == '\n') {
      digitalWrite(8, bNote);
      digitalWrite(7, aNote);
      digitalWrite(6, gNote);
      digitalWrite(5, fNote);
      digitalWrite(4, eNote);
      digitalWrite(3, dNote);
      digitalWrite(2, cNote);
      
      
      Serial.print(mappedNote);
      Serial.print(',');
    }
  }
}

//NEW TAB

#define NOTE_B0  31
#define NOTE_C1  33
#define NOTE_CS1 35
#define NOTE_D1  37
#define NOTE_DS1 39
#define NOTE_E1  41
#define NOTE_F1  44
#define NOTE_FS1 46
#define NOTE_G1  49
#define NOTE_GS1 52
#define NOTE_A1  55
#define NOTE_AS1 58
#define NOTE_B1  62
#define NOTE_C2  65
#define NOTE_CS2 69
#define NOTE_D2  73
#define NOTE_DS2 78
#define NOTE_E2  82
#define NOTE_F2  87
#define NOTE_FS2 93
#define NOTE_G2  98
#define NOTE_GS2 104
#define NOTE_A2  110
#define NOTE_AS2 117
#define NOTE_B2  123
#define NOTE_C3  131
#define NOTE_CS3 139
#define NOTE_D3  147
#define NOTE_DS3 156
#define NOTE_E3  165
#define NOTE_F3  175
#define NOTE_FS3 185
#define NOTE_G3  196
#define NOTE_GS3 208
#define NOTE_A3  220
#define NOTE_AS3 233
#define NOTE_B3  247
#define NOTE_C4  262
#define NOTE_CS4 277
#define NOTE_D4  294
#define NOTE_DS4 311
#define NOTE_E4  330
#define NOTE_F4  349
#define NOTE_FS4 370
#define NOTE_G4  392
#define NOTE_GS4 415
#define NOTE_A4  440
#define NOTE_AS4 466
#define NOTE_B4  494
#define NOTE_C5  523
#define NOTE_CS5 554
#define NOTE_D5  587
#define NOTE_DS5 622
#define NOTE_E5  659
#define NOTE_F5  698
#define NOTE_FS5 740
#define NOTE_G5  784
#define NOTE_GS5 831
#define NOTE_A5  880
#define NOTE_AS5 932
#define NOTE_B5  988
#define NOTE_C6  1047
#define NOTE_CS6 1109
#define NOTE_D6  1175
#define NOTE_DS6 1245
#define NOTE_E6  1319
#define NOTE_F6  1397
#define NOTE_FS6 1480
#define NOTE_G6  1568
#define NOTE_GS6 1661
#define NOTE_A6  1760
#define NOTE_AS6 1865
#define NOTE_B6  1976
#define NOTE_C7  2093
#define NOTE_CS7 2217
#define NOTE_D7  2349
#define NOTE_DS7 2489
#define NOTE_E7  2637
#define NOTE_F7  2794
#define NOTE_FS7 2960
#define NOTE_G7  3136
#define NOTE_GS7 3322
#define NOTE_A7  3520
#define NOTE_AS7 3729
#define NOTE_B7  3951
#define NOTE_C8  4186
#define NOTE_CS8 4435
#define NOTE_D8  4699
#define NOTE_DS8 4978

Processing:

//this is for serial communication
import processing.serial.*;
Serial myPort;

  int channel = 0;
  int midiB4 = 71;
  int midiAB4 = 70;
  int midiA4 = 69;
  int midiGA4 = 68;
  int midiG4 = 67;
  int midiFG4 = 66;
  int midiF4 = 65;
  int midiE4 = 64;
  int midiDE4 = 63;
  int midiD4 = 62;
  int midiCD4 = 61;
  int midiC4 = 60;
  
  int velocity = 127;
  int timeInterval = 25; //keep at 25
  
  int wholeNote = 64*timeInterval;
  int halfNote = 32*timeInterval;
  int thirdNote = 24*timeInterval;
  int quarterNote = 16*timeInterval;
  int eighthNote = 8*timeInterval;
  int sixteenthNote = 4*timeInterval;
  int thirtysecondNote = 2*timeInterval;
  int sixtyfourthNote = 1*timeInterval;
  
  int freq=0;
  
  boolean bNoteOnOff=false;
  boolean aNoteOnOff=false;
  boolean gNoteOnOff=false;
  boolean fNoteOnOff=false;
  boolean eNoteOnOff=false;
  boolean dNoteOnOff=false;
  boolean cNoteOnOff=false;
  
  PImage beethoven;
  PImage happyBirthday;
  PImage littleApple;
  PImage uae;

//this is for MIDI
import themidibus.*; //Import the library

MidiBus myBus; // The MidiBus

void setup(){
  size(displayWidth, displayHeight);
  background(255);
  
  beethoven = loadImage("beethoven.png");
  happyBirthday = loadImage("happyBirthday.png");
  littleApple = loadImage("littleApple.png");
  uae = loadImage("uae.png");
  
  image(beethoven, 0, 0, displayWidth/2, displayHeight/2);
  image(happyBirthday, displayWidth/2, 0, displayWidth/2, displayHeight/2);
  image(littleApple, 0, displayHeight/2, displayWidth/2, displayHeight/2);
  image(uae, displayWidth/2, displayHeight/2, displayWidth/2, displayHeight/2);
  
  //this is for serial communication
  printArray(Serial.list());
  String portname=Serial.list()[4];
  println(portname);
  myPort = new Serial(this,portname,9600);
  myPort.clear();
  myPort.bufferUntil('\n');
  
  textSize(40);
  fill(255);
  text("Press: 1", displayWidth/4, displayHeight/2 - 30);
  fill(0);
  text("Press: 2", displayWidth - displayWidth/4, displayHeight/2 - 30);
  text("Press: 3", displayWidth/4, displayHeight/2 + 20);
  text("Press: 4", displayWidth - displayWidth/4, displayHeight/2 + 20);
  
  MidiBus.list(); // List all available Midi devices on STDOUT. This will show each device's index and name.
  myBus = new MidiBus(this, -1, "sforzando"); // Create a new MidiBus with no input device and the default Java Sound Synthesizer as the output device.
}


void draw(){
  
  int value = 90;
  int channel = 0;
  
  myBus.sendControllerChange(channel, freq, value); // Send a controllerChange
  delay(2000);
  println("Frequency:" );
  print(freq);
}

void keyPressed(){
  switch(key){
    case'1': playOdeToJoy();
    break;
    case'2': playHappyBirthday();
    break;
    case'3': playXiaoPingGuo();
    break;
    case'4': playIshyBilady();
    break;
  }
}


void noteOn(int channel, int pitch, int velocity) {
  // Receive a noteOn
  println();
  println("Note On:");
  println("--------");
  println("Channel:"+channel);
  println("Pitch:"+pitch);
  println("Velocity:"+velocity);
}

void noteOff(int channel, int pitch, int velocity) {
  // Receive a noteOff
  println();
  println("Note Off:");
  println("--------");
  println("Channel:"+channel);
  println("Pitch:"+pitch);
  println("Velocity:"+velocity);
}

void controllerChange(int channel, int number, int value) {
  // Receive a controllerChange
  println();
  println("Controller Change:");
  println("--------");
  println("Channel:"+channel);
  println("Number:"+number);
  println("Value:"+value);
}

void delay(int time) {
  int current = millis();
  while (millis () < current+time) Thread.yield();
}

void serialEvent(Serial myPort){
  String s=myPort.readStringUntil('\n');
  s=trim(s);
  if (s!=null){
    println(s);
    int values[]=int(split(s,','));
    if (values.length==1){
      freq=(int)map(values[0],0,6,60,71);
    }
  }
  myPort.write(int(cNoteOnOff)+","+int(dNoteOnOff)+","+int(eNoteOnOff)+","+int(fNoteOnOff)+","+int(gNoteOnOff)+","+int(aNoteOnOff)+","+int(bNoteOnOff)+"\n");
}


//NEW TAB

void playHappyBirthday(){
  
  myBus.sendNoteOn(channel, midiC4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = true;
  delay(eighthNote);
  myBus.sendNoteOff(channel, midiC4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiC4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = true;
  delay(eighthNote);
  myBus.sendNoteOff(channel, midiC4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiD4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = true;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiD4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiC4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = true;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiC4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiF4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = true;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiF4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiE4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = true;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(halfNote);
  myBus.sendNoteOff(channel, midiE4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiC4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = true;
  delay(eighthNote);
  myBus.sendNoteOff(channel, midiC4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiC4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = true;
  delay(eighthNote);
  myBus.sendNoteOff(channel, midiC4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiD4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = true;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiD4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiC4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = true;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiC4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiG4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = true;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiG4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiF4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = true;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(halfNote);
  myBus.sendNoteOff(channel, midiF4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiC4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = true;
  delay(eighthNote);
  myBus.sendNoteOff(channel, midiC4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiC4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = true;
  delay(eighthNote);
  myBus.sendNoteOff(channel, midiC4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiC4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = true;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiC4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiA4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = true;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiA4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiF4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = true;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiF4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiE4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = true;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiE4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiD4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = true;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiD4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiB4, velocity); // Send a Midi noteOn
  bNoteOnOff = true;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(eighthNote);
  myBus.sendNoteOff(channel, midiB4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiB4, velocity); // Send a Midi noteOn
  bNoteOnOff = true;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(eighthNote);
  myBus.sendNoteOff(channel, midiB4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiA4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = true;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiA4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiF4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = true;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiF4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiG4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = true;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiG4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiF4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = true;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(halfNote);
  myBus.sendNoteOff(channel, midiF4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  int number = 0;
  int value = 90;

  myBus.sendControllerChange(channel, number, value); // Send a controllerChange
  delay(2000);
}

//NEW TAB

void playIshyBilady(){
  
  myBus.sendNoteOn(channel, midiC4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = true;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiC4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiF4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = true;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(eighthNote);
  myBus.sendNoteOff(channel, midiF4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiE4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = true;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(eighthNote);
  myBus.sendNoteOff(channel, midiE4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiF4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = true;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiF4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiC4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = true;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiC4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiF4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = true;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiF4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiG4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = true;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(eighthNote);
  myBus.sendNoteOff(channel, midiG4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiA4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = true;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(eighthNote);
  myBus.sendNoteOff(channel, midiA4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiA4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = true;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiA4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiG4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = true;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(eighthNote);
  myBus.sendNoteOff(channel, midiG4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiF4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = true;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(eighthNote);
  myBus.sendNoteOff(channel, midiF4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiE4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = true;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiE4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiF4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = true;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(eighthNote);
  myBus.sendNoteOff(channel, midiF4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiG4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = true;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(eighthNote);
  myBus.sendNoteOff(channel, midiG4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiG4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = true;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(halfNote);
  myBus.sendNoteOff(channel, midiG4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  int number = 0;
  int value = 90;

  myBus.sendControllerChange(channel, number, value); // Send a controllerChange
  delay(2000);
}


//NEW TAB

void playOdeToJoy(){

  myBus.sendNoteOn(channel, midiE4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = true;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiE4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiE4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = true;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiE4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiF4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = true;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiF4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiG4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = true;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiG4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiG4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = true;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiG4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiF4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = true;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiF4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiE4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = true;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiE4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiD4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = true;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiD4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiC4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = true;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiC4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiC4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = true;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiC4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiD4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = true;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiD4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiE4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = true;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiE4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiE4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = true;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(thirdNote);
  myBus.sendNoteOff(channel, midiE4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiD4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = true;
  cNoteOnOff = false;
  delay(eighthNote);
  myBus.sendNoteOff(channel, midiD4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiD4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = true;
  cNoteOnOff = false;
  delay(halfNote);
  myBus.sendNoteOff(channel, midiD4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;

  int number = 0;
  int value = 90;

  myBus.sendControllerChange(channel, number, value); // Send a controllerChange
  delay(2000);
}


//NEW TAB

void playXiaoPingGuo(){
  
  myBus.sendNoteOn(channel, midiD4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = true;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiD4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiAB4, velocity); // Send a Midi noteOn
  bNoteOnOff = true;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiAB4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiC4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = true;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiC4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiG4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = true;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiG4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiD4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = true;
  cNoteOnOff = false;
  delay(eighthNote);
  myBus.sendNoteOff(channel, midiD4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiC4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = true;
  delay(eighthNote);
  myBus.sendNoteOff(channel, midiC4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiAB4, velocity); // Send a Midi noteOn
  bNoteOnOff = true;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(eighthNote);
  myBus.sendNoteOff(channel, midiAB4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiC4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = true;
  delay(eighthNote);
  myBus.sendNoteOff(channel, midiC4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiG4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = true;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiG4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  delay(eighthNote);
  
  myBus.sendNoteOn(channel, midiD4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = true;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiD4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiAB4, velocity); // Send a Midi noteOn
  bNoteOnOff = true;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiAB4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiC4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = true;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiC4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiC4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = true;
  delay(eighthNote);
  myBus.sendNoteOff(channel, midiC4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiC4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = true;
  delay(eighthNote);
  myBus.sendNoteOff(channel, midiC4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiF4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = true;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiF4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiD4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = true;
  cNoteOnOff = false;
  delay(quarterNote);
  myBus.sendNoteOff(channel, midiD4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiA4, velocity); // Send a Midi noteOn
  bNoteOnOff = false;
  aNoteOnOff = true;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(thirdNote);
  myBus.sendNoteOff(channel, midiA4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  myBus.sendNoteOn(channel, midiAB4, velocity); // Send a Midi noteOn
  bNoteOnOff = true;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  delay(halfNote);
  myBus.sendNoteOff(channel, midiAB4, velocity); // Send a Midi nodeOff
  bNoteOnOff = false;
  aNoteOnOff = false;
  gNoteOnOff = false;
  fNoteOnOff = false;
  eNoteOnOff = false;
  dNoteOnOff = false;
  cNoteOnOff = false;
  
  int number = 0;
  int value = 90;

  myBus.sendControllerChange(channel, number, value); // Send a controllerChange
  delay(2000);
  
}

 

Leave a Reply