#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <SD.h>
#include <SPI.h>
#include <MIDI.h>
LiquidCrystal_I2C lcd(0x27, 20, 4);
#define MIDI_CHANNEL 1
int settings_C = 1;
int current_setting = 1;
int drum = 1;
const int Kick = 36;
const int Snare = 39;
const int Snare_R = 34;
const int Floor_Tom = 35;
const int Floor_Tom_R = 32;
const int Rack_Tom_1 = 33;
const int Rack_Tom_2 = 25;
const int High_Hat = 26;
const int High_Hat_P = 27;
const int Ride_Edge = 14;
const int Ride_Mid = 13;
const int Ride_Center = 15;
const int Crash = 4;
int Kick_T = 350;
int Snare_T = 150;
int Snare_R_T = 200;
int Floor_Tom_T = 150;
int Floor_Tom_R_T = 200;
int Rack_Tom_1_T = 100;
int Rack_Tom_2_T = 100;
int High_Hat_T = 100;
int Ride_Edge_T = 400;
int Ride_Mid_T = 250;
int Ride_Center_T = 150;
int Crash_T = 400;
int Max_Ride1 = 0;
int Max_Ride2 = 0;
int Max_Ride3 = 0;
int HH_Closed_note = 47;
int HH_75_note = 48;
int HH_50_note = 49;
int HH_25_note = 52;
int HH_Open_note = 54;
int HH_Pedal_note = 46;
//High Hat Threshold
int HH_Closed_T = 2500;
int HH_75_T = 1800;
int HH_50_T = 1200;
int HH_25_T = 600;
int HH_Open_T = 200;
int HH_Pedal_T = 1500;
int ADR1;
//Encoder Pins
#define clk 2
#define dt 16
#define sw 17
bool doonce = 0;
boolean changestate = 0;
volatile boolean TurnDetected;
volatile boolean up;
void isr0 () {
TurnDetected = true;
up = (digitalRead(clk) == digitalRead(dt));
}
const unsigned long debounceTime1 = 100;
const unsigned long debounceTime2 = 100;
const unsigned long debounceTime3 = 100;
const unsigned long debounceTime4 = 100;
const unsigned long debounceTime5 = 100;
const unsigned long debounceTime6 = 100;
const unsigned long debounceTime7 = 100;
const unsigned long debounceTime8 = 100;
const unsigned long debounceTime9 = 100;
const unsigned long debounceTime10 = 100;
const unsigned long debounceTime11 = 100;
const unsigned long debounceTime12 = 100;
const unsigned long debounceTime13 = 100;
// Define individual last trigger times for each piezo sensor
unsigned long lastTriggerTime1 = 0;
unsigned long lastTriggerTime2 = 0;
unsigned long lastTriggerTime3 = 0;
unsigned long lastTriggerTime4 = 0;
unsigned long lastTriggerTime5 = 0;
unsigned long lastTriggerTime6 = 0;
unsigned long lastTriggerTime7 = 0;
unsigned long lastTriggerTime8 = 0;
unsigned long lastTriggerTime9 = 0;
unsigned long lastTriggerTime10 = 0;
unsigned long lastTriggerTime11 = 0;
unsigned long lastTriggerTime12 = 0;
unsigned long lastTriggerTime13 = 0;
int note1 = 34;
int note2 = 36;
int note3 = 40;
int note4 = 65;
int note5 = 0;
int note6 = 0;
int note7 = 0;
int note8 = 0;
int note9 = 0;
int note10 = 0;
int note11 = 0;
int note12 = 0;
int note13 = 0;
//Defining Velocity
int velocity1 = 0;
int velocity2 = 0;
int velocity3 = 0;
int velocity4 = 0;
int velocity5 = 0;
int velocity6 = 0;
int velocity7 = 0;
int velocity8 = 0;
int velocity9 = 0;
int velocity10 = 0;
int velocity11 = 0;
int velocity12 = 0;
int velocity13 = 0;
//Defining Max Velocities
int maxvelo1 = 127;
int maxvelo2 = 127;
int maxvelo3 = 127;
int maxvelo4 = 127;
int maxvelo5 = 127;
int maxvelo6 = 127;
int maxvelo7 = 127;
int maxvelo8 = 127;
int maxvelo9 = 127;
int maxvelo10 = 127;
int maxvelo11 = 127;
int maxvelo12 = 127;
int maxvelo13 = 127;
MIDI_CREATE_DEFAULT_INSTANCE();
void setup() {
Serial.begin(115200);
lcd.begin(20, 4);
lcd.init();
lcd.backlight();
pinMode(Kick, INPUT);
pinMode(Snare, INPUT);
pinMode(Snare_R, INPUT);
pinMode(Floor_Tom, INPUT);
pinMode(Floor_Tom_R, INPUT);
pinMode(Rack_Tom_1, INPUT);
pinMode(Rack_Tom_2, INPUT);
pinMode(Ride_Edge, INPUT);
pinMode(Ride_Mid, INPUT);
pinMode(Ride_Center, INPUT);
pinMode(High_Hat, INPUT);
pinMode(High_Hat_P, INPUT);
pinMode(Crash, INPUT);
//Encoder Pins
pinMode(clk, INPUT);
pinMode(dt, INPUT);
pinMode(sw, INPUT_PULLUP);
attachInterrupt (2, isr0, RISING);
}
void loop() {
unsigned long currentTime = millis();//Gets Current Time
//For Piezo EIGHT (HIGH_HATS)
if(analogRead(High_Hat) > High_Hat_T && currentTime - lastTriggerTime8 > debounceTime8) {
velocity8 = map(analogRead(High_Hat), High_Hat_T, 4095, 0, maxvelo8);
if(High_Hat_P > HH_Closed_T)
{
MIDI.sendNoteOn(HH_Closed_note, velocity8, MIDI_CHANNEL);
}
else if(High_Hat_P < HH_Closed_T && High_Hat_P > HH_75_T){
MIDI.sendNoteOn(HH_75_note, velocity8, MIDI_CHANNEL);
}
else if(High_Hat_P < HH_Closed_T && High_Hat_P < HH_75_T && High_Hat_P > HH_50_T){
MIDI.sendNoteOn(HH_50_note, velocity8, MIDI_CHANNEL);
}
else if(High_Hat_P < HH_Closed_T && High_Hat_P < HH_75_T && High_Hat_P < HH_50_T && High_Hat_P > HH_25_T){
MIDI.sendNoteOn(HH_25_note, velocity8, MIDI_CHANNEL);
}
else if(High_Hat_P < HH_Closed_T && High_Hat_P < HH_75_T && High_Hat_P < HH_50_T && High_Hat_P < HH_25_T){
MIDI.sendNoteOn(HH_Open_note, velocity8, MIDI_CHANNEL);
}
lastTriggerTime8 = currentTime; //Update Last Trigger Time
}
//For Piezo NINE (HIGH_HAT_PEDAL)
if (analogRead(High_Hat_P) > HH_Pedal_T && currentTime - lastTriggerTime9 > debounceTime9) {
velocity9 = map(analogRead(High_Hat_P), HH_Pedal_T, 4095, 0, maxvelo9);
//Send MIDI Data
MIDI.sendNoteOn(HH_Pedal_note, velocity9, MIDI_CHANNEL);
lastTriggerTime1 = currentTime; //Update Last Trigger Time
}
//For Piezo ONE (KICK)
if (analogRead(Kick) > Kick_T && currentTime - lastTriggerTime1 > debounceTime1) {
velocity1 = map(analogRead(Kick), Kick_T, 4095, 0, maxvelo1);
//Send MIDI Data
MIDI.sendNoteOn(note1, velocity1, MIDI_CHANNEL);
lastTriggerTime1 = currentTime; //Update Last Trigger Time
}
//For Piezo TWO (SNARE)
if (analogRead(Snare) > Snare_T && currentTime - lastTriggerTime2 > debounceTime2) {
velocity2 = map(analogRead(Snare), Snare_T, 4095, 0, maxvelo2);
//Send MIDI Data
MIDI.sendNoteOn(note2, velocity2, MIDI_CHANNEL);
lastTriggerTime2 = currentTime; //Update Last Trigger Time
}
//For Piezo THREE (SNARE_RIM)
if (analogRead(Snare_R) > Snare_R_T && currentTime - lastTriggerTime3 > debounceTime3) {
velocity3 = map(analogRead(Snare_R), Snare_R_T, 4095, 0, maxvelo3);
//Send MIDI Data
MIDI.sendNoteOn(note3, velocity3, MIDI_CHANNEL);
lastTriggerTime3 = currentTime; //Update Last Trigger Time
}
//For Piezo FOUR (FLOOR_TOM)
if (analogRead(Floor_Tom) > Floor_Tom_T && currentTime - lastTriggerTime4 > debounceTime4) {
velocity4 = map(analogRead(Floor_Tom), Floor_Tom_T, 4095, 0, maxvelo4);
//Send MIDI Data
MIDI.sendNoteOn(note4, velocity4, MIDI_CHANNEL);
lastTriggerTime4 = currentTime; //Update Last Trigger Time
}
//For Piezo FIVE (FLOOR_TOM_RIM)
if (analogRead(Floor_Tom_R) > Floor_Tom_R_T && currentTime - lastTriggerTime5 > debounceTime5) {
velocity5 = map(analogRead(Floor_Tom_R), Floor_Tom_R_T, 4095, 0, maxvelo5);
//Send MIDI Data
MIDI.sendNoteOn(note5, velocity5, MIDI_CHANNEL);
lastTriggerTime5 = currentTime; //Update Last Trigger Time
}
//For Piezo SIX (RACK_TOM_1)
if(analogRead(Rack_Tom_1) > Rack_Tom_1_T && currentTime - lastTriggerTime6 > debounceTime6) {
velocity6 = map(analogRead(Rack_Tom_1), Rack_Tom_1_T, 4095, 0, maxvelo6);
//Send MIDI Data
MIDI.sendNoteOn(note6, velocity6, MIDI_CHANNEL);
lastTriggerTime6 = currentTime; //Update Last Trigger Time
}
//For Piezo SEVEN (RACK_TOM_2)
if(analogRead(Rack_Tom_2) > Rack_Tom_2_T && currentTime - lastTriggerTime7 > debounceTime7) {
velocity7 = map(analogRead(Rack_Tom_2), Rack_Tom_2_T, 4095, 0, maxvelo7);
//Send MIDI Data
MIDI.sendNoteOn(note7, velocity7, MIDI_CHANNEL);
lastTriggerTime7 = currentTime; //Update Last Trigger Time
}
// HIGH_HAT AND PEDAL IS 8 AND 9
//For Piezo TEN (RIDE_EDGE)
if(analogRead(Ride_Edge) > Ride_Edge_T && currentTime - lastTriggerTime10 > debounceTime10){
velocity10 = map(analogRead(Ride_Edge), Ride_Edge_T, 4095, 0, maxvelo10);
Max_Ride1 = analogRead(Ride_Edge);
}
//For Piezo ELEVEN (RIDE_MID)
if(analogRead(Ride_Mid) > Ride_Mid_T && currentTime - lastTriggerTime11 > debounceTime11){
velocity11 = map(analogRead(Ride_Mid), Ride_Mid_T, 4095, 0, maxvelo11);
Max_Ride2 = analogRead(Ride_Mid);
}
//For Piezo TWELVE (RIDE_CENTER)
if(analogRead(Ride_Center) > Ride_Center_T && currentTime - lastTriggerTime12 > debounceTime12){
velocity12 = map(analogRead(Ride_Center), Ride_Center_T, 4095, 0, maxvelo12);
Max_Ride3 = analogRead(Ride_Center);
}
//Assigning Notes Piezo 10 (RIDE_EDGE)
if(Max_Ride1 > Max_Ride2 && Max_Ride1 > Max_Ride3){
MIDI.sendNoteOn(note10, velocity10, MIDI_CHANNEL);
}
//Assigning Notes For Piezo 11 (RIDE_MID)
if(Max_Ride2 > Max_Ride1 && Max_Ride2 > Max_Ride3){
MIDI.sendNoteOn(note11, velocity11, MIDI_CHANNEL);
}
//Assinging Notes For Piezo 12 (RIDE_CENTER)
if(Max_Ride3 > Max_Ride1 && Max_Ride3 > Max_Ride2){
MIDI.sendNoteOn(note12, velocity12, MIDI_CHANNEL);
}
//For Piezo THIRTEEN (CRASH)
if(analogRead(Crash) > Crash_T && currentTime - lastTriggerTime13 > debounceTime13) {
velocity13 = map(analogRead(Crash), Crash_T, 4095, 0, maxvelo13);
//Send MIDI Data
MIDI.sendNoteOn(note13, velocity13, MIDI_CHANNEL);
lastTriggerTime13 = currentTime; //Update Last Trigger Time
}
Settings();
}
void Settings(){
boolean select = false;
boolean normal = true;
if(digitalRead(sw) == LOW){
select = true;
normal = false;
}
if(normal){
//Encoder
if (TurnDetected) {
delay(200);
doonce = 0;
if (changestate == 0) {
if (up) {
settings_C++;
if(settings_C > 17){
settings_C = 1;
}
}
else {
settings_C = settings_C - 1;
if (settings_C < 1) {
settings_C = 1;
}
}
TurnDetected = false;
}
}
}
else if(select){
int var_sel = 1;
//Encoder
if (TurnDetected) {
delay(200);
doonce = 0;
if (changestate == 0) {
if (up) {
var_sel++;
if(var_sel > 3){
var_sel = 1;
}
}
else {
var_sel = var_sel - 1;
if (var_sel < 1) {
var_sel = 1;
}
}
TurnDetected = false;
}
}
if(var_sel == 1){
lcd.setCursor(1, 1);
lcd.print(">");
lcd.setCursor(1, 2);
lcd.print(" ");
lcd.setCursor(1, 3);
lcd.print(" ");
current_setting = 1;
}
else if(var_sel == 2){
lcd.setCursor(1, 1);
lcd.print(" ");
lcd.setCursor(1, 2);
lcd.print(">");
lcd.setCursor(1, 3);
lcd.print(" ");
current_setting = 2;
}
else if(var_sel == 3){
lcd.setCursor(1, 1);
lcd.print(" ");
lcd.setCursor(1, 2);
lcd.print(" ");
lcd.setCursor(1, 3);
lcd.print(">");
current_setting = 3;}
}
//Printing Drum Name On LCD
lcd.setCursor(0,0);
edit_name(settings_C);
lcd.setCursor(3, 1);
lcd.print("THRESHOLD:");
display_threshold(settings_C);
lcd.setCursor(3, 2);
lcd.print("NOTE:");
display_note(settings_C);
lcd.setCursor(3, 3);
lcd.print("MAX_VELOCITY:");
display_velocity(settings_C);
Serial.print("Encoder:");
Serial.println(settings_C);
if(select){
update_thresh();
}
}
void display_threshold(int thresh_C) {
int thresh = 0;
if(thresh_C == 1){
thresh = Kick_T;
}
else
if(thresh_C == 1){
thresh = Kick_T;
}
else if(thresh_C == 2){
thresh = Snare_T;
}
else if(thresh_C == 3){
thresh = Snare_R_T;
}
else if(thresh_C == 4){
thresh = Floor_Tom_T;
}
else if(thresh_C == 5){
thresh = Floor_Tom_R_T;
}
else if(thresh_C == 6){
thresh = Rack_Tom_1_T;
}
else if(thresh_C == 7){
thresh = Rack_Tom_2_T;
}
else if(thresh_C == 8){
thresh = Ride_Edge_T;
}
else if(thresh_C ==9){
thresh = Ride_Mid_T;
}
else if(thresh_C == 10){
thresh = Ride_Center_T;
}
else if(thresh_C == 11){
thresh = Crash_T;
}
else if(thresh_C == 12){
thresh = HH_Closed_T;
}
else if(thresh_C == 13){
thresh = HH_75_T;
}
else if(thresh_C == 14){
thresh = HH_50_T;
}
else if(thresh_C == 15){
thresh = HH_25_T;
}
else if(thresh_C == 16){
thresh = HH_Open_T;
}
else if(thresh_C == 17){
thresh = HH_Pedal_T;
}
lcd.print(thresh);
lcd.print(" ");
}
void update_thresh(){
int ut_C = 0;
//Encoder
if (TurnDetected) {
delay(200);
doonce = 0;
if (changestate == 0) {
if (up) {
ut_C + 50;
if(ut_C > 4095){
ut_C = 4095;
}
}
else {
ut_C = ut_C = 50;
if (ut_C < 1) {
ut_C = 1;
}
}
TurnDetected = false;
}
}
if(drum == 1 && current_setting == 1){
ut_C = Kick_T;
}
else if(drum == 2 && current_setting == 1){
ut_C = Snare_T;
Snare_T = ut_C;
}
else if(drum == 3 && current_setting == 1){
ut_C = Snare_R_T;
Snare_R_T = ut_C;
}
else if(drum == 4 && current_setting == 1){
ut_C = Floor_Tom_T;
Floor_Tom_T = ut_C;
}
else if(drum == 5 && current_setting == 1){
ut_C = Floor_Tom_R_T;
Floor_Tom_R_T = ut_C;
}
else if(drum == 6 && current_setting == 1){
ut_C = Rack_Tom_1_T;
Rack_Tom_2_T = ut_C;
}
else if(drum == 7 && current_setting == 1){
ut_C = Ride_Edge_T;
Ride_Edge_T = ut_C;
}
else if(drum == 8 && current_setting == 1){
ut_C = Snare_T;
Snare_T = ut_C;
}
else if(drum == 9 && current_setting == 1){
ut_C = Snare_T;
Snare_T = ut_C;
}
else if(drum == 10 && current_setting == 1){
ut_C = Snare_T;
Snare_T = ut_C;
}
else if(drum == 11 && current_setting == 1){
ut_C = Snare_T;
Snare_T = ut_C;
}
else if(drum == 12 && current_setting == 1){
ut_C = Snare_T;
Snare_T = ut_C;
}
else if(drum == 13 && current_setting == 1){
ut_C = Snare_T;
Snare_T = ut_C;
}
else if(drum == 14 && current_setting == 1){
ut_C = Snare_T;
Snare_T = ut_C;
}
else if(drum == 15 && current_setting == 1){
ut_C = Snare_T;
Snare_T = ut_C;
}
else if(drum == 16 && current_setting == 1){
ut_C = Snare_T;
Snare_T = ut_C;
}
else if(drum == 17 && current_setting == 1){
ut_C = Snare_T;
Snare_T = ut_C;
}
}
void display_note(int note_C){
int display_note = 0;
if(note_C == 1){
display_note = note1;
notes(display_note);
}
else if(note_C == 2){
display_note = note2;
notes(display_note);
}
else if(note_C == 3){
display_note = note3;
notes(display_note);
}
else if(note_C == 4){
display_note = note4;
notes(display_note);
}
else if(note_C == 5){
display_note = note5;
notes(display_note);
}
else if(note_C == 6){
display_note = note6;
notes(display_note);
}
else if(note_C == 7){
display_note = note7;
notes(display_note);
}
else if(note_C == 8){
display_note = note10;
notes(display_note);
}
else if(note_C == 9){
display_note = note11;
notes(display_note);
}
else if(note_C == 10){
display_note = note12;
notes(display_note);
}
else if(note_C == 11){
display_note = note13;
notes(display_note);
}
else if(note_C == 12){
display_note = HH_Closed_note;
notes(display_note);
}
else if(note_C == 13){
display_note = HH_75_note;
notes(display_note);
}
else if(note_C == 14){
display_note = HH_50_note;
notes(display_note);
}
else if(note_C == 15){
display_note = HH_25_note;
notes(display_note);
}
else if(note_C == 16){
display_note = HH_Open_note;
notes(display_note);
}
else if(note_C == 17){
display_note = HH_Pedal_note;
notes(display_note);
}
}
void display_velocity(int velo_C){
int velo = 0;
if(velo_C == 1){
velo = maxvelo1;
}
else if(velo_C == 2){
velo = maxvelo2;
}
else if(velo_C == 3){
velo = maxvelo3;
}
else if(velo_C == 4){
velo = maxvelo4;
}
else if(velo_C == 5){
velo = maxvelo5;
}
else if(velo_C == 6){
velo = maxvelo6;
}
else if(velo_C == 7){
velo = maxvelo7;
}
else if(velo_C == 8){
velo = maxvelo8;
}
else if(velo_C == 9){
velo = maxvelo9;
}
else if(velo_C == 10){
velo = maxvelo10;
}
else if(velo_C == 11){
velo = maxvelo11;
}
else if(velo_C == 12){
velo = maxvelo12;
}
else if(velo_C == 13){
velo = maxvelo13;
}
lcd.print(velo);
}
void encoder(int C, int M){
if (TurnDetected) {
delay(200);
doonce = 0;
if (changestate == 0) {
if (up) {
C++;
if(C > M){
C = 1;
}
}
else {
C = C - 1;
if (C < 0) {
C = 0;
}
}
TurnDetected = false;
}
}
}
void edit_name(int drum){
String drum_name = "";
if(drum == 1){
drum_name = " KICK ";
}
else if(drum == 2){
drum_name = " SNARE ";
}
else if(drum == 3){
drum_name = " SNARE_RIM ";
}
else if(drum == 4){
drum_name = " FLOOR_TOM ";
}
else if(drum == 5){
drum_name = " FLOOR_TOM_RIM ";
}
else if(drum == 6){
drum_name = " RACK_T0M_1 ";
}
else if(drum == 7){
drum_name = " RACK_TOM_2 ";
}
else if(drum == 8){
drum_name = " PAISTE_CRASH ";
}
else if(drum == 9){
drum_name = " PAISTE_RIDE ";
}
else if(drum == 10){
drum_name = " PAISTE_BELL ";
}
else if(drum == 11){
drum_name = " CRASH ";
}
else if(drum == 12){
drum_name = " HIGH-HAT_CLOSED ";
}
else if(drum == 13){
drum_name = " HIGH-HAT_75% CLOSED";
}
else if(drum == 14){
drum_name = " HIGH-HAT_50% CLOSED";
}
else if(drum == 15){
drum_name = " HIGH-HAT_25% CLOSED";
}
else if(drum == 16){
drum_name = " HIGH-HAT_OPEN ";
}
else if(drum == 17){
drum_name = "HIGH-HAT_PEDAL_NOISE";
}
lcd.print(drum_name);
}
void DDM(){
lcd.setCursor(3,1);
lcd.print("DIGITAL DRUM");
lcd.setCursor(6,2);
lcd.print("MODULE");
}
void notes(int noteval) {
String note = "";
if(noteval <= 21){
noteval = 21;
}
if(noteval >= 108){
noteval = 108;
}
//Converting NOTEVAL To Actual Musical Notes For LCD
if(noteval == 21){
note = "A0";
}
else if(noteval == 22){
note = "Bb0";
}
else if(noteval == 23){
note = "B0";
}
else if(noteval == 24){
note = "C1";
}
else if(noteval == 25){
note = "Db1";
}
else if(noteval == 26){
note = "D1";
}
else if(noteval == 27){
note = "Eb1";
}
else if(noteval == 28){
note = "E1";
}
else if(noteval == 29){
note = "F1";
}
else if(noteval == 30){
note = "Gb1";
}
else if(noteval == 31){
note = "G1";
}
else if(noteval == 32){
note = "Ab1";
}
else if(noteval == 33){
note = "A1";
}
else if(noteval == 34){
note = "Bb1";
}
else if(noteval == 35){
note = "B1";
}
else if(noteval == 36){
note = "C2";
}
else if(noteval == 37){
note = "Db2";
}
else if(noteval == 38){
note = "D2";
}
else if(noteval == 39){
note = "Eb2";
}
else if(noteval == 40){
note = "E2";
}
else if(noteval == 41){
note = "F2";
}
else if(noteval == 42){
note = "Gb2";
}
else if(noteval == 43){
note = "G2";
}
else if(noteval == 44){
note = "Ab2";
}
else if(noteval == 45){
note = "A2";
}
else if(noteval == 46){
note = "Bb2";
}
else if(noteval == 47){
note = "B2";
}
else if(noteval == 48){
note = "C3";
}
else if(noteval == 49){
note = "Db3";
}
else if(noteval == 50){
note = "D3";
}
else if(noteval == 51){
note = "Eb3";
}
else if(noteval == 52){
note = "E3";
}
else if(noteval == 53){
note = "F3";
}
else if(noteval == 54){
note = "Gb3";
}
else if(noteval == 55){
note = "G3";
}
else if(noteval == 56){
note = "Ab3";
}
else if(noteval == 57){
note = "A3";
}
else if(noteval == 58){
note = "Bb3";
}
else if(noteval == 59){
note = "B3";
}
else if(noteval == 60){
note = "C4";
}
else if(noteval == 61){
note = "Db4";
}
else if(noteval == 62){
note = "D4";
}
else if(noteval == 63){
note = "Eb4";
}
else if(noteval == 64){
note = "E4";
}
else if(noteval == 65){
note = "F4";
}
else if(noteval == 66){
note = "Gb4";
}
else if(noteval == 67){
note = "G4";
}
else if(noteval == 68){
note = "Ab4";
}
else if(noteval == 69){
note = "A4";
}
else if(noteval == 70){
note = "Bb4";
}
else if(noteval == 71){
note = "B4";
}
else if(noteval == 72){
note = "C5";
}
else if(noteval == 73){
note = "Db5";
}
else if(noteval == 74){
note = "D5";
}
else if(noteval == 75){
note = "Eb5";
}
else if(noteval == 76){
note = "E5";
}
else if(noteval == 77){
note = "F5";
}
else if(noteval == 78){
note = "Gb5";
}
else if(noteval == 79){
note = "G5";
}
else if(noteval == 80){
note = "Ab5";
}
else if(noteval == 81){
note = "A5";
}
else if(noteval == 82){
note = "Bb5";
}
else if(noteval == 83){
note = "B5";
}
else if(noteval == 84){
note = "C6";
}
else if(noteval == 85){
note = "Db6";
}
else if(noteval == 86){
note = "D6";
}
else if(noteval == 87){
note = "Eb6";
}
else if(noteval == 88){
note = "E6";
}
else if(noteval == 89){
note = "F6";
}
else if(noteval == 90){
note = "Gb6";
}
else if(noteval == 91){
note = "G6";
}
else if(noteval == 92){
note = "Ab6";
}
else if(noteval == 93){
note = "A6";
}
else if(noteval == 94){
note = "Bb6";
}
else if(noteval == 95){
note = "B6";
}
else if(noteval == 96){
note = "C7";
}
else if(noteval == 97){
note = "Db7";
}
else if(noteval == 98){
note = "D7";
}
else if(noteval == 99){
note = "Eb7";
}
else if(noteval == 100){
note = "E7";
}
else if(noteval == 101){
note = "F7";
}
else if(noteval == 102){
note = "Gb7";
}
else if(noteval == 103){
note = "G7";
}
else if(noteval == 104){
note = "Ab7";
}
else if(noteval == 105){
note = "A7";
}
else if(noteval == 106){
note = "Bb7";
}
else if(noteval == 107){
note = "B7";
}
else if(noteval == 108){
note = "C8";
}
lcd.print(note);
lcd.print("(" + String(noteval) + ")");
lcd.print(" ");
}