error message with midi code

hey fellas, im having a issue with this code. im getting a error message about noteOn wasnt delcared in the scope, but the odd thing is this code as compiled before. i donno, ive googled around and i havnt come up with anything that really fits my issue, ive seen where people were missing spaces or typo, but ive looked over the code an i am a noob at coding it looks lagit to me. if anyone can help spot something im not seeing that would be great. thanks.

// what midi channel is being sent
// ranges from 0-15
#define drumchan           2

// general midi drum notes
#define note_bassdrum     33
#define note_snaredrum    37 // RED PAD
#define note_hihatclosed  44 // FOOT SWITCH FOR CLOSED HI HAT 
#define note_hihatopen    22 // YELLOW CYMBAL, PIN 0
#define note_crash        49 // GREEN CYMBAL.A5
#define note_hitom        48 // 
#define note_lowtom       45 //
#define note_floortom     41 //
#define note_ridecym      51 // BLUE CYMBOL A6



// define the pins we use
#define switchAPin 10 //bass pedal, DIGITAL PIN 10 
#define switchCPin 2 // hihatclosed pedal, DIGITAL PIN 2???????????????????????
#define piezoAPin  0 //hi hat open pedal, YELLOW CYMBAL, ANALOG PIN 0
#define piezoBPin  1 //hi tom YELLOWA1
#define piezoCPin  2 //snare drum RED A2
#define piezoDPin  3 // low tom BLUE A3
#define piezoEPin  4 // floor tom GREEN A4
#define piezoFPin  5 // GREEEN CYMBAL A5
#define piezoGPin  6 // BLUE CYMBAL A6
#define ledPin     13  // for midi out status

// analog threshold for piezo sensing
#define PIEZOTHRESHOLD1 500 //YELLOW CYMBAL
#define PIEZOTHRESHOLD2 500//YELLOW PAD
#define PIEZOTHRESHOLD3 500//RED PAD
#define PIEZOTHRESHOLD4 500 //BLUE PAD
#define PIEZOTHRESHOLD5 500 //GREEN PAD
#define PIEZOTHRESHOLD6 500 //GREEN CYMBAL
#define PIEZOTHRESHOLD7 500//BLUE CYMBAL


int switchAState = LOW;

int switchCState = LOW;
int currentSwitchState = LOW;
// variables will change:
int buttonState = 0;      
   // variable for reading the pushbutton status

int val,t;

void setup() {
  pinMode(switchAPin, INPUT);
  pinMode(switchCPin, INPUT);
 
  digitalWrite(switchAPin, HIGH);  // turn on internal pullup
  digitalWrite(switchCPin, HIGH);  // turn on internal pullup



  pinMode(ledPin, OUTPUT);
  Serial.begin(31250);   // set MIDI baud rate
}

void loop() {

  
  // deal with switchA BASS DRUM
  currentSwitchState = digitalRead(switchAPin);
  if( currentSwitchState == LOW && switchAState == HIGH ) // push
    noteOn(drumchan,  note_bassdrum, 100);
  if( currentSwitchState == HIGH && switchAState == LOW ) // release
    noteOff(drumchan, note_bassdrum, 0);
  switchAState = currentSwitchState;

  // deal with HI HAT CLOSED FOOT PEDLE
  currentSwitchState = digitalRead(switchCPin);
  if( currentSwitchState == LOW && switchCState == HIGH ) // push
    noteOn(drumchan,  note_hihatclosed, 100);
  if( currentSwitchState == HIGH && switchCState == LOW ) // release
    noteOff(drumchan, note_hihatclosed, 0);
  switchCState = currentSwitchState;

  // 1 deal with first piezo, HI HAT OPEN, YELLOW CYMBAL
  val = analogRead(piezoAPin);
  if( val >= PIEZOTHRESHOLD1 ) {
    t=0;
    while(analogRead(piezoAPin) >= PIEZOTHRESHOLD1/2) {
      t++;
    }
    noteOn(drumchan,note_hihatopen, t*2);
    delay(t);
    noteOff(drumchan,note_hihatopen,0);
  }

  // 2 deal with second piezos, HITOM, YELLOW PAD
  val = analogRead(piezoBPin);
  if( val >= PIEZOTHRESHOLD2 ) {
    t=0;
    while(analogRead(piezoBPin) >= PIEZOTHRESHOLD2/2) {
      t++;
    }
    noteOn(drumchan,note_hitom, t*2);
    delay(t);
    noteOff(drumchan,note_hitom,0);
  }
  // 3 deal with second piezos,SNARE DRUM RED PAD
  val = analogRead(piezoCPin);
  if( val >= PIEZOTHRESHOLD3 ) {
    t=0;
    while(analogRead(piezoCPin) >= PIEZOTHRESHOLD3/2) {
      t++;
    }
    noteOn(drumchan,note_snaredrum, t*2);
    delay(t);
    noteOff(drumchan,note_snaredrum,0);
  }
    // 4 deal with second piezos, LOW TOM BLUE PAD
  val = analogRead(piezoDPin);
  if( val >= PIEZOTHRESHOLD4 ) {
    t=0;
    while(analogRead(piezoDPin) >= PIEZOTHRESHOLD4/2) {
      t++;
    }
    noteOn(drumchan,note_lowtom, t*2);
    delay(t);
    noteOff(drumchan,note_lowtom,0);
  }
      // 5 deal with second piezos, FLOOR TOM GREEN PAD
  val = analogRead(piezoEPin);
  if( val >= PIEZOTHRESHOLD5 ) {
    t=0;
    while(analogRead(piezoEPin) >= PIEZOTHRESHOLD5/2) {
      t++;
    }
    noteOn(drumchan,note_floortom, t*2);
    delay(t);
    noteOff(drumchan,note_floortom,0);
  }
  // 6 deal with second piezos,CRASH GREEN CYMBAL
  val = analogRead(piezoFPin);
  if( val >= PIEZOTHRESHOLD6 ) {
    t=0;
    while(analogRead(piezoFPin) >= PIEZOTHRESHOLD6/2) {
      t++;
    }
    noteOn(drumchan,note_crash, t*2);
    delay(t);
    noteOff(drumchan,note_crash,0);
  }
  // 7 deal with 7TH piezos,BLUE CYMBAL
  val = analogRead(piezoGPin);
  if( val >= PIEZOTHRESHOLD7 ) {
    t=0;
    while(analogRead(piezoGPin) >= PIEZOTHRESHOLD7/2) {
      t++;
    }
  {
    noteOn(drumchan,note_ridecym, t*2);
    delay(t);
    noteOff(drumchan,note_ridecym,0);
  }

}

// Send a MIDI note-on message.  Like pressing a piano key
// channel ranges from 0-15
void noteOn(byte channel, byte note, byte velocity) {
  midiMsg( (0x90 | channel), note, velocity);
}

// Send a MIDI note-off message.  Like releasing a piano key
void noteOff(byte channel, byte note, byte velocity) {
  midiMsg( (0x80 | channel), note, velocity);
}

// Send a general MIDI message
void midiMsg(byte cmd, byte data1, byte data2) {
  digitalWrite(ledPin,HIGH);  // indicate we're sending MIDI data
  Serial.write(cmd);
  Serial.write(data1);
  Serial.write(data2);
  digitalWrite(ledPin,LOW);
}

the error is noteOns and the noteOffs are not declared in the scope.

any help would be appreciated.

Your problem is in that long and rambling loop function you have lost track of your braces the { and the }

Click on the last } in the loop function and you will see that the matching one that is highlighted is only at:-
if( val >= PIEZOTHRESHOLD7 ) {
And not where it should be at:-

void loop() {

Therefore the compiler still thinks it is going through the loop function and it skips over the noteOn function definition, so when it encounters it in the code then it thinks "I don't know this function - it must be an error"

thank you mike, i just had to add one at the end. an as for my void loop what would you recommend about making it clearer, or less rambled.

My 2 cents worth:

I find that the braces style

if (condition {
}

don't work as well as

if (condition)
{
}

when it comes to matching braces.

I would recommend that you split your loop function code into smaller functions, then your loop function would just call these. Once a function gets over a page long it becomes difficult to keep track of it. This also reduces the depth of braces you need.

Now that the IDE compleats some braces for you I find I get too many because I always put them in before writing the code in them.