how to modify this code

This code works but only for 1 note on pin, (A0) How can I make an array so that each pin plays a different midi note?

[code][/* Use a Piezo sensor (percussion / drum) to send USB MIDI note on
   messages, where the "velocity" represents how hard the Piezo was
   tapped.

   Connect a Pieze sensor to analog pin A0.  This example was tested
   with Murata 7BB-27-4L0.  Almost any piezo sensor (not a buzzer with
   built-in oscillator electronics) may be used.  However, Piezo
   sensors are easily damaged by excessive heat if soldering.  It
   is highly recommended to buy a Piezo with wires already attached!

   Use a 100K resistor between A0 to GND, to give the sensor a "load".
   The value of this resistor determines how "sensitive" the circuit is.

   A pair of 1N4148 diodes are recommended to protect the analog pin.
   The first diode connects to A0 with its stripe (cathode) and the other
   side to GND.  The other diode connects its non-stripe (anode) side to
   A0, and its stripe (cathode) side to 3.3V.

   Sensitivity may also be tuned with the map() function.  Uncomment
   the Serial.print lines to see the actual analog measurements in the
   Arduino Serial Monitor.

   You must select MIDI from the "Tools > USB Type" menu

   This example code is in the public domain.
*/

const int channel = 10;  // General MIDI: channel 10 = percussion sounds
const int note = 38;     // General MIDI: note 38 = acoustic snare

const int analogPin = A0;
const int thresholdMin = 60;  // minimum reading, avoid noise and false starts
const int peakTrackMillis = 12;
const int aftershockMillis = 25; // aftershocks & vibration reject


void setup() {
  Serial.begin(115200);
  while (!Serial && millis() < 2500) /* wait for serial monitor */ ;
  Serial.println("Piezo Peak Capture");
}


void loop() {
  int piezo = analogRead(analogPin);
  peakDetect(piezo);
  // Add other tasks to loop, but avoid using delay() or waiting.
  // You need loop() to keep running rapidly to detect Piezo peaks!

  // MIDI Controllers should discard incoming MIDI messages.
  // http://forum.pjrc.com/threads/24179-Teensy-3-Ableton-Analog-CC-causes-midi-crash
  while (usbMIDI.read()) {
    // ignore incoming messages
  }
}


void peakDetect(int voltage) {
  // "static" variables keep their numbers between each run of this function
  static int state;  // 0=idle, 1=looking for peak, 2=ignore aftershocks
  static int peak;   // remember the highest reading
  static elapsedMillis msec; // timer to end states 1 and 2

  switch (state) {
    // IDLE state: wait for any reading is above threshold.  Do not set
    // the threshold too low.  You don't want to be too sensitive to slight
    // vibration.
    case 0:
      if (voltage > thresholdMin) {
        //Serial.print("begin peak track ");
        //Serial.println(voltage);
        peak = voltage;
        msec = 0;
        state = 1;
      }
      return;

    // Peak Tracking state: capture largest reading
    case 1:
      if (voltage > peak) {
        peak = voltage;     
      }
      if (msec >= peakTrackMillis) {
        Serial.print("peak = ");
        Serial.println(peak);
        int velocity = map(peak, thresholdMin, 1023, 1, 127);
        usbMIDI.sendNoteOn(note, velocity, channel);
        msec = 0;
        state = 2;
      }
      return;

    // Ignore Aftershock state: wait for things to be quiet again.
    default:
      if (voltage > thresholdMin) {
        msec = 0; // keep resetting timer if above threshold
      } else if (msec > aftershockMillis) {
        usbMIDI.sendNoteOff(note, 0, channel);
        state = 0; // go back to idle when
      }
  }
}

I tried replacing this line  (const int analogPin = A0;)  with  
/code][const int InputCount = 4;
int piezo[InputCount] = {
  A0, A1, A2, A3,};
int note[InputCount] = {
  50, 51, 52, 53,};/code]

[/code]
but could not get it to work

Any details as to how to do that?

const int channel = 10;  // General MIDI: channel 10 = percussion sounds
const int PINS = 22;     // number of signals incoming
const int note[PINS] = {36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57};     // array of MIDI note values for read signals

const int analogPin[PINS] = {A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,}; //array of analog PINs 
const int thresholdMin = 60;  // minimum reading, avoid noise and false starts
const int peakTrackMillis = 12;
const int aftershockMillis = 25; // aftershocks & vibration reject
  
int state[PINS];  // 0=idle, 1=looking for peak, 2=ignore aftershocks
int peak[PINS];   // remember the highest reading
int piezo[PINS];
elapsedMillis msec[PINS]; // timer to end states 1 and 2

void setup() {
  Serial.begin(115200);
  while (!Serial && millis() < 2500) /* wait for serial monitor */ ;
  Serial.println("Piezo Peak Capture");
}


void loop() {


  for (int i=0;i<PINS;i++){
    piezo[i] = analogRead(analogPin[i]);
  
  int voltage=piezo[i];
  
    switch (state[i]) {
      // IDLE state: wait for any reading is above threshold.  Do not set
      // the threshold too low.  You don't want to be too sensitive to slight
      // vibration.
      case 0:
        if (voltage > thresholdMin) {
          //Serial.print("begin peak track ");
          //Serial.println(voltage);
          peak[i] = voltage;
          msec[i] = 0;
          state[i] = 1;
        }
        return;
  
      // Peak Tracking state: capture largest reading
      case 1:
        if (voltage > peak[i]) {
          peak[i] = voltage;     
        }
        if (msec[i] >= peakTrackMillis) {
          //Serial.print("peak = ");
          //Serial.println(peak);
          int velocity = map(peak[i], thresholdMin, 1023, 22, 127);
          usbMIDI.sendNoteOn(note[i], velocity, channel);
          msec[i] = 0;
          state[i] = 2;
        }
        return;
  
      // Ignore Aftershock state: wait for things to be quiet again.
      default:
        if (voltage > thresholdMin) {
          msec[i] = 0; // keep resetting timer if above threshold
        } else if (msec[i] > aftershockMillis) {
          usbMIDI.sendNoteOff(note[i], 0, channel);
          state[i] = 0; // go back to idle when
        }
    }
  }
  // Add other tasks to loop, but avoid using delay() or waiting.
  // You need loop() to keep running rapidly to detect Piezo peaks!

  // MIDI Controllers should discard incoming MIDI messages.
  // http://forum.pjrc.com/threads/24179-Teensy-3-Ableton-Analog-CC-causes-midi-crash
  while (usbMIDI.read()) {
    // ignore incoming messages
  }
}


void peakDetect(int voltage) {
}]

Sorry the reason I posted this is because it doesn't work. The only pin that works is A0. Somehow my text didn't get included when i posted this. I was hoping someone could spot the problem.

   This example code is in the public domain.
   *multi-pad extension by oddson (under-tested)*
*/
const int channel = 10;  // General MIDI: channel 10 = percussion sounds
const int PINS = 23;     // number of signals incoming

const int note[PINS] = {36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,59}; // array of MIDI note values for read signals

const int analogPin[PINS] = {A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21,}; //array of analog PINs 
const int thresholdMin = 60; // minimum reading, avoid noise and false starts
const int peakTrackMillis = 12;
const int aftershockMillis = 25; // aftershocks & vibration reject

int state[PINS];  // 0=idle, 1=looking for peak, 2=ignore aftershocks
int peak[PINS];   // remember the highest reading
int piezo[PINS];
elapsedMillis msec[PINS]; // timers to end states 1 and 2

void setup() {
  Serial.begin(115200);
  while (!Serial && millis() < 2500) /* wait for serial monitor */ ;
  Serial.println("Piezo Peak Capture");
}


void loop() {
  for (int i=0;i<PINS;i++){
    //delay(20);
    piezo[i] = analogRead(analogPin[i]);
 
  peakDetect(i);
  // Add other tasks to loop, but avoid using delay() or waiting.
  // You need loop() to keep running rapidly to detect Piezo peaks!

}
  // MIDI Controllers should discard incoming MIDI messages.
  // http://forum.pjrc.com/threads/24179-Teensy-3-Ableton-Analog-CC-causes-midi-crash
  while (usbMIDI.read()) {
    // ignore incoming messages
  }
}


void peakDetect(int i) {

        //Serial.println(state[i]);

  switch (state[i]) {
    // IDLE state: wait for any reading is above threshold.  Do not set
    // the threshold too low.  You don't want to be too sensitive to slight
    // vibration.
    case 0:
      if (piezo[i] > thresholdMin) {
        //Serial.print("begin peak track ");
        //Serial.println(piezo[i]);
        peak[i] = piezo[i];
        msec[i] = 0;
        state[i] = 1;
      }
      return;

    // Peak Tracking state: capture largest reading
    case 1:
      if (piezo[i] > peak[i]) {
        peak[i] = piezo[i];     
      }
      if (msec[i] >= peakTrackMillis) {
        //Serial.print("peak = ");
        //Serial.println(peak);
        int velocity = map(peak[i], thresholdMin, 1023, 1, 127);
        usbMIDI.sendNoteOn(note[i], velocity, channel);
        msec[i] = 0;
        state[i] = 2;
      }
      return;

    // Ignore Aftershock state: wait for things to be quiet again.
    default:
      if (piezo[i] > thresholdMin) {
        msec[i] = 0; // keep resetting timer if above threshold
      } else if (msec[i] > aftershockMillis) {
        usbMIDI.sendNoteOff(note[i], 0, channel);
        state[i] = 0; // go back to idle when
      }
  }
}

I write my message, add the code, hit post... message gone. This happens without code. Anyway the code does work now I need to add a hi hat pedal which is just a FSR on pin A22. It will trigger a note when fully down but also determine which of 3 notes is played on pad #4, which will be pin A2 I'm not sure how to write this or where to put it. If the value of the FSR is about 400 when up and 0 when fully down something like this?

if value of A 22 <10 A22 plays note#39

if value of A 22 > 300 A3 plays note #40
if value of A 22 < 300 but > 50 A3 plays note #41
if value of A 22 < 50 A3 plays note #42