How to combine 2 different inputs for 1 output

We are using a guitar hero controller and having an Arduino produce frequencies. The push buttons on the guitar function but we want them to be combined with the buckler on the guitar to change the frequency from a sharp to a flat. We are considering using an If and statement, or a while statement, to combine both of them but can’t get it to work. Any kind of input or advice would be awesome. Here is the code that we have at the moment

const int ledPin2 = 7;
const int ledPin = 8 ;
// create an array of notes
// the numbers below correspond to
// the frequencies of middle C, D, E, and F
int notes = {10, 2000, 1500, 5000, 100};

void setup() {
//start serial communication
pinMode(ledPin2, INPUT); // sets the digital pin 7 as input
pinMode(ledPin, INPUT); // sets the digital pin 8 as input

void loop() {
// create a local variable to hold the input on pin A0
int keyVal = analogRead(A0);
// send the value from A0 to the Serial Monitor

// play the note corresponding to each value on A0
if (keyVal == 1023) {
// play the first frequency in the array on pin 8
tone(8, notes[0]);
} else if (keyVal >= 990 && keyVal <= 1010) {
// play the second frequency in the array on pin 8
tone(8, notes[1]);
} else if (keyVal >= 505 && keyVal <= 515) {
// play the third frequency in the array on pin 8
tone(8, notes[2]);
} else if (keyVal >= 5 && keyVal <= 10) {
// play the fourth frequency in the array on pin 8
tone(8, notes[3]);
} else {
// if the value is out of range, play no tone

while (digitalRead(ledPin) == HIGH and (ledPin2) == HIGH) {
tone(8, notes[4]);

From the names it looks like you are outputting a tone to an LED. That can't be right. Mind you, most code does not have a smiley in it either.

Did you read this before posting a programming question

As to your problem, there is no reason why you can't test the value of a second input and modify the tone played. A 2 dimensional array would allow you to have 2 sets of tones, one for second input LOW and the other one for HIGH