turning keyboard intrument project into music player (need help code wont comp)

#include "pitches.h"

int melody[] = 
int button [0] = 2
int buttons[6]
{
NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,
   NOTE_B3,NOTE_G3,NOTE_C4,NOTE_G3,NOTE_CS4,NOTE_G3,NOTE_C4,NOTE_G3,NOTE_B3,NOTE_G3,NOTE_C4,NOTE_G3,NOTE_CS4,NOTE_G3,NOTE_C4,NOTE_G3,
   NOTE_E4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_E4,NOTE_E4,NOTE_E4,
   NOTE_E4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_E4,NOTE_E4,NOTE_E4,NOTE_E4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_E4,NOTE_E4,NOTE_E4,
  NOTE_E4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_E4,NOTE_E4,NOTE_E4,
  NOTE_E4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_E4,NOTE_E4,NOTE_E4,
  NOTE_E4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_E4,NOTE_E4,NOTE_E4,
  NOTE_DS5,NOTE_D5,NOTE_B4,NOTE_A4,NOTE_B4,
  NOTE_E4,NOTE_G4,NOTE_DS5,NOTE_D5,NOTE_G4,NOTE_B4,
  NOTE_B4,NOTE_FS5,NOTE_F5,NOTE_B4,NOTE_D5,NOTE_AS5,
  NOTE_A5,NOTE_F5,NOTE_A5,NOTE_DS6,NOTE_D6
};

int noteDurations[] = {
8,8,2,8,8,2,16,8,16,8,8,
   2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,
   8,16,16,8,4,8,8,8,
   8,16,16,8,4,8,8,8,8,
   16,16,8,4,8,8,8,
  8,16,16,8,4,8,8,8,
  8,16,16,8,4,8,8,8,
  8,16,16,8,4,8,8,8,
  8,2,8,8,1,
  8,4,8,4,8,8,
  8,8,4,8,4,8,
  4,8,4,8,3
};

void setup() {

  for (int thisNote = 0; thisNote < 100; thisNote++) {

   
    int noteDuration = 1000 / noteDurations[thisNote];
    tone(13, melody[thisNote], noteDuration);
    int pauseBetweenNotes = noteDuration * 1;
    delay(pauseBetweenNotes);
    noTone(13);
  }
}

void loop() {
 int keyVal = analogRead (A0) ;
 if (keyval == noteDeration){
   tone (8, melody[0] );}
 }
 else if (analogRead > 100 && analogRead <= 1010){
  tone(8, note[1]);
 }

(tags added by moderator)

Your array setups need work.

int arrayName = {value1, value2, ...., valueN,};

make this an array callout

if (keyval == noteDeration[whatgoeshere?]){

noteDuration is mis-spelled also.

this is my original code and it works perfectly

#include “pitches.h”
#define NO_SOUND 0 ;
int melody =
{
NOTE_C5, NOTE_F5, NOTE_C5, NOTE_F4, NOTE_A4, NOTE_C5, NOTE_F5, NOTE_C5,
NOTE_C5, NOTE_F5, NOTE_C5, NOTE_F5,
NOTE_A5, NOTE_G5, NOTE_F5, NOTE_E5, NOTE_D5, NOTE_CS5,
NOTE_C5, NOTE_F5, NOTE_C5, NOTE_F4, NOTE_A4, NOTE_C5, NOTE_F5, NOTE_C5,
NOTE_F5, NOTE_D5, NOTE_C5, NOTE_AS4,
NOTE_A4, NOTE_G4, NOTE_F4,NOTE_C5, NOTE_F5, NOTE_C5, NOTE_F4, NOTE_A4, NOTE_C5, NOTE_F5, NOTE_C5,
NOTE_C5, NOTE_F5, NOTE_C5, NOTE_F5,
NOTE_A5, NOTE_G5, NOTE_F5, NOTE_E5, NOTE_D5, NOTE_CS5,
NOTE_C5, NOTE_F5, NOTE_C5, NOTE_F4, NOTE_A4, NOTE_C5, NOTE_F5, NOTE_C5,
NOTE_F5, NOTE_D5, NOTE_C5, NOTE_AS4,
NOTE_A4, NOTE_G4, NOTE_F4, NO_SOUND 0
};

int noteDurations = {
4, 4, 4, 8, 8, 4, 4, 2,
4, 4, 4, 4,
3, 8, 8, 8, 8, 8,
4, 4, 4, 8, 8, 4, 4, 2,
3, 8, 4, 4,
4, 4, 2 ,4, 4, 4, 8, 8, 4, 4, 2,
4, 4, 4, 4,
3, 8, 8, 8, 8, 8,
4, 4, 4, 8, 8, 4, 4, 2,
3, 8, 4, 4,
4, 4, 2
};

void setup() {

for (int thisNote = 0; thisNote < 100; thisNote++) {

int noteDuration = 1000 / noteDurations[thisNote];
tone(13, melody[thisNote], noteDuration);
int pauseBetweenNotes = noteDuration * 1.40;
delay(pauseBetweenNotes);
noTone(13);
}
}

void loop() { }

So you see the syntax needed then. Fix up your modified code to match.

You appear to have stuck these into midst of the melody definition

int button [0] = 2
int buttons[6]

which are not complete lines

You stuck this in loop

 int keyVal = analogRead (A0) ;
 if (keyval == noteDeration){ <<< noteDeration is misspelled
   tone (8, melody[0] );}         <<< incomplete syntax - now output is on pin 8?
 }
 else if (analogRead > 100 && analogRead <= 1010){ <<< need keyval here, not analogRead
  tone(8, note[1]);
                               <<< missing a } to close the else if action

so im scratching the code that i put up. im just a beginner so im not too sure what to do. i want to be able to have 3 buttons and each button has its on individual song

#include "pitches.h"

int melody[] = 
{
NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,
   NOTE_B3,NOTE_G3,NOTE_C4,NOTE_G3,NOTE_CS4,NOTE_G3,NOTE_C4,NOTE_G3,NOTE_B3,NOTE_G3,NOTE_C4,NOTE_G3,NOTE_CS4,NOTE_G3,NOTE_C4,NOTE_G3,
   NOTE_E4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_E4,NOTE_E4,NOTE_E4,
   NOTE_E4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_E4,NOTE_E4,NOTE_E4,NOTE_E4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_E4,NOTE_E4,NOTE_E4,
  NOTE_E4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_E4,NOTE_E4,NOTE_E4,
  NOTE_E4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_E4,NOTE_E4,NOTE_E4,
  NOTE_E4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_E4,NOTE_E4,NOTE_E4,
  NOTE_DS5,NOTE_D5,NOTE_B4,NOTE_A4,NOTE_B4,
  NOTE_E4,NOTE_G4,NOTE_DS5,NOTE_D5,NOTE_G4,NOTE_B4,
  NOTE_B4,NOTE_FS5,NOTE_F5,NOTE_B4,NOTE_D5,NOTE_AS5,
  NOTE_A5,NOTE_F5,NOTE_A5,NOTE_DS6,NOTE_D6
};
int button[3] = {1, 2, 3};
int noteDurations[] = {
8,8,2,8,8,2,16,8,16,8,8,
   2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,
   8,16,16,8,4,8,8,8,
   8,16,16,8,4,8,8,8,8,
   16,16,8,4,8,8,8,
  8,16,16,8,4,8,8,8,
  8,16,16,8,4,8,8,8,
  8,16,16,8,4,8,8,8,
  8,2,8,8,1,
  8,4,8,4,8,8,
  8,8,4,8,4,8,
  4,8,4,8,3
};

void setup() {

  for (int thisNote = 0; thisNote < 100; thisNote++) {

   
    int noteDuration = 1000 / noteDurations[thisNote];
    tone(13, melody[thisNote], noteDuration);
    int pauseBetweenNotes = noteDuration * 1;
    delay(pauseBetweenNotes);
    noTone(13);
  }
}

void loop() { }

Define the 3 melodys, each with 3 arrays:

int melody1[] = {...}; // do these need to be int? or can they be byte? byte uses 1/2 the memory
int noteDuration1[] = { ...}; // do these need to be int? or can they be byte?

int melody2[] = {...};
int noteDuration2[] = { ...};

int melody3[] = {...};
int noteDuration3[] = { ...};

Then call them out:

byte button1 = 2; // or whatever pins are being used
byte button2 = 3;
byte button3 = 4;
void setup() {
pinMode (button1, INPUT_PULLUP);  // button with internal pullup, switch presses connects to Gnd
pinMode (button2, INPUT_PULLUP);
pinMode (button3, INPUT_PULLUP);
}
void loop(){
if (digitalRead(button1) == LOW){
  for (int thisNote = 0; thisNote < 100; thisNote++) {
    int noteDuration = 1000 / noteDuration1[thisNote];
    tone(13, melody1[thisNote], noteDuration);
    int pauseBetweenNotes = noteDuration * 1.40;
    delay(pauseBetweenNotes);
    noTone(13);
  }
if (digitalRead(button2) == LOW){
  for (int thisNote = 0; thisNote < 100; thisNote++) {
    int noteDuration = 1000 / noteDuration2[thisNote];
    tone(13, melody2[thisNote], noteDuration);
    int pauseBetweenNotes = noteDuration * 1.40;
    delay(pauseBetweenNotes);
    noTone(13);
  }
if (digitalRead(button3) == LOW){
  for (int thisNote = 0; thisNote < 100; thisNote++) {
    int noteDuration = 1000 / noteDuration3[thisNote];
    tone(13, melody3[thisNote], noteDuration);
    int pauseBetweenNotes = noteDuration * 1.40;
    delay(pauseBetweenNotes);
    noTone(13);
  }
}

thanks you for your help !!!