playing mp3 sounds with a button press with some arguments.

Hi all. I have attached the adafruit mp3 music maker shield to the mega and used their player_simple sketch. Everything works as it should with two tracks being played. I have included my code for my game I have been working on. It compiles fine but when I upload to the mega and push my buttons I hear nothing. I have been using the serial monitor to observe the button push on pin 15. I see the value in arr 1 change from 0 to 1. When I push another button it resets/changes back to 0 as expected. I think the problem is in how I am calling the music player??? Any help appreciated as always.

/***************************************************
  This is an example for the Adafruit VS1053 Codec Breakout

  Designed specifically to work with the Adafruit VS1053 Codec Breakout
  ----> https://www.adafruit.com/products/1381

  Written by Limor Fried/Ladyada for Adafruit Industries.
  BSD license, all text above must be included in any redistribution
 ****************************************************/

// include SPI, MP3 and SD libraries
#include <SPI.h>
#include <Adafruit_VS1053.h>
#include <SD.h>
// These are the pins used for the music maker shield
#define SHIELD_RESET  -1      // VS1053 reset pin (unused!)
#define SHIELD_CS     7      // VS1053 chip select pin (output)
#define SHIELD_DCS    6      // VS1053 Data/command select pin (output)
#define CARDCS 4     // Card chip select pin
#define DREQ 3       // VS1053 Data request, ideally an Interrupt pin

Adafruit_VS1053_FilePlayer musicPlayer =
  // create shield-example object!
  Adafruit_VS1053_FilePlayer(SHIELD_RESET, SHIELD_CS, SHIELD_DCS, DREQ, CARDCS);
//Each pin has a switch to activate it. switchPin 15 (arr 1) makes a pair with switch 26 (arr 12). When each is pressed music player plays "homer000.mp3" and
//if both pressed music player than plays "excell00.mp3.
//If the switches do not match musicPlayer needs to play "failure01.mp3".
int switchPins[] = {14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,53, A8, A9, A10, A11, A12, A13, A14, A15};
int pinCount = 45;
bool arr[44];//variable to hold what switches were pressed
int switchOpenedCount = 45;
char* simpsonSounds [] = {"itchy000.mp3", "homer000.mp3", "willy000.mp3", "arpu0000.mp3", "itchy000.mp3", "mrburns0.mp3", "bart0000.mp3", "wigam000.mp3", "wigam000.mp3", "flanders.mp3", "lisa0000.mp3", "marg0000.mp3", "homer000.mp3", "marg0000.mp3", "lisa0000.mp3", "krusty00.mp3", "snowball.mp3", "itchy000.mp3", "maggie00.mp3", "nelson00.mp3", "milhouse.mp3", "milhouse.mp3", "nelson00.mp3",
                          "grandpa0.mp3", "snowball.mp3", "santa000.mp3", "bart0000.mp3", "maggie00.mp3", "milhouse.mp3", "krusty00.mp3", "grandpa0.mp3", "bartman0.mp3", "bartman0.mp3", "flanders.mp3", "santa000.mp3", "willy000.mp3", "fink0000.mp3", "mrburns0.mp3", "ralph000.mp3", "ralph000.mp3", "fink0000.mp3", "hans0000.mp3", "hans0000.mp3", "arpu0000.mp3", "itchy000.mp3",
                         };
//There are two other files on the card   excell00.mp3 and failure0.mp3 not part of the above array.
void setup() {
  SD.begin(CARDCS);    // initialise the SD card
  // Set volume for left, right channels. lower numbers == louder volume!
  musicPlayer.setVolume(20, 20);

  // Timer interrupts are not suggested, better to use DREQ interrupt!
  //musicPlayer.useInterrupt(VS1053_FILEPLAYER_TIMER0_INT); // timer int

  // If DREQ is on an interrupt pin (on uno, #2 or #3) we can do background
  // audio playing
  musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT);  // DREQ int
  Serial.begin(9600);
  for (int thisPin = 0; thisPin < pinCount; thisPin++) {
    pinMode(switchPins[thisPin], INPUT_PULLUP);
  }
  //turns all bool arr to false.
  for (int switchOpen = 0; switchOpen < switchOpenedCount; switchOpen++) {
    arr[switchOpen] = false;
  }

}

void loop() {
  int sensorValue = arr[1];//Used to test if button on pin 15 is registering the push.
  Serial.println(sensorValue);
  for (int thisPin = 0; thisPin < pinCount; thisPin++)
  {
    if (digitalRead(switchPins[thisPin]) == LOW)
    { arr[thisPin] = true;
      musicPlayer.playFullFile(simpsonSounds[thisPin]);


    }
  }
  //Repeat this logic for every pair of switches.
  if (arr[1] == true)
  {
    if (arr[12] == true)
    { musicPlayer.playFullFile("excell00.mp3");
      //set doors/arr back to false
      for (int switchOpen = 0; switchOpen < switchOpenedCount; switchOpen++) {
        arr[switchOpen] = false;
      }
    }
    else
    {
      for (int thisPin = 0; thisPin < pinCount; thisPin++)
      {
        if (thisPin != 1 && thisPin != 12 && arr[thisPin] == true)
        { //doors do not match so play 'wrong' sound.
          musicPlayer.playFullFile("failure0.mp3");
          //set arr/doors back to false
          for (int switchOpen = 0; switchOpen < switchOpenedCount; switchOpen++) {
            arr[switchOpen] = false;


          }
        }
      }
    }
  }
  if (arr[12] == true)
  {
    if (arr[1] == true)
    { //doors match so play success sound
      musicPlayer.playFullFile("excell00.mp3");
      //set doors/arr back to false
      for (int switchOpen = 0; switchOpen < switchOpenedCount; switchOpen++) {
        arr[switchOpen] = false;
      }
    }
    else
    {
      for (int thisPin = 0; thisPin < pinCount; thisPin++)
      {
        if (thisPin != 12 && thisPin != 1 && arr[thisPin] == true)
        { //doors do not match so play 'wrong' sound.
          musicPlayer.playFullFile("failure0.mp3");
          //set arr/doors back to false
          for (int switchOpen = 0; switchOpen < switchOpenedCount; switchOpen++) {
            arr[switchOpen] = false;


          }
        }
      }
    }
  }
}

Hi all. I have attached the adafruit mp3 music maker shield to the mega and used their player_simple sketch. Everything works as it should with two tracks being played.

Are you sure?
From:-
https://www.arduino.cc/en/Main/ArduinoBoardMega2560

SPI: 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS). These pins support SPI communication using the SPI library. The SPI pins are also broken out on the ICSP header, which is physically compatible with the Arduino /Genuino Uno and the old Duemilanove and Diecimila Arduino boards.

So anything that is expecting the SPI to be on the same pins as the Uno is not going to work on the Mega.
Also the interrupt structure is not the same on a Uno and a Mega.

So it looks like what you are finding is correct, it is only that first quote that is a puzzle. Unless of course that first sketch does not use the SPI.

Yep it works. When I upload the sketch I hear the two tracks I am meant to hear. Here are the instructions I followed.

There are three 'totally fixed' pins, the hardware SPI pins:
SPI SCK - connected to Digital #13 (but can be connected to the ISP header with a jumper) -
used by both the SD card and VS1053
SPI MISO - connected to Digital #12 (but can be connected to the ISP header with a jumper) -
used by both the SD card and VS1053
SPI MOSI - connected to Digital #11 (but can be connected to the ISP header with a jumper) -
used by both the SD card and VS1053
There are a couple other pins that are required for talking to the VS1053 to play MP3s and such
MCS - this is the VS1053 chip select pin, connected to Digital #7
DCS - this is the VS1053 data select pin, connected to Digital #6
CCS - this is the SD Card chip select pin, connected to Digital #4
DREQ - this is the VS1053 data request interrupt pin - connected to digital #3
Ther are also a few other pins that are not connected to any Arduino pin but are broken out:
RST - this is the VS1053 reset pin, we connected it to the Arduino reset pin so you don't need
to use this unless you really want to.
SPK Off - this disables the amplifier - if you have the amplifier version and want to 'mute'
instantly
TX - this is serial data transmit from the VS1053 - its not used for any of our demos
RS - this is serial data into the VS1053 - its used for MIDI synth playing
CD - this is the card detect pin, it is tied to ground when a card is inserted. Use a pullup on a
digital pin to detect when a SD card is inserted. We dont use it.
SPI Jumpers
If you're using a Mega or Leonardo Arduino, you'll need to short the jumpers on the top right of the
board, and install the 2x3 socket header. This is because those Arduinos use the 2x3 pin header for
the hardware-SPI pins and hardware-SPI is required for the high-speed data transfer required by
the VS1053 codec.

When I upload my sketch it will not update the value in arr 1 when I push the pins button unless I remove the command
musicPlayer.playFullFile(simpsonSounds[thisPin]); When removed I press the button and the arr is updated.
Here is the simple_player sketch

/*************************************************** 
  This is an example for the Adafruit VS1053 Codec Breakout

  Designed specifically to work with the Adafruit VS1053 Codec Breakout 
  ----> https://www.adafruit.com/products/1381

  Adafruit invests time and resources providing this open source code, 
  please support Adafruit and open-source hardware by purchasing 
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.  
  BSD license, all text above must be included in any redistribution
 ****************************************************/

// include SPI, MP3 and SD libraries
#include <SPI.h>
#include <Adafruit_VS1053.h>
#include <SD.h>

// define the pins used
//#define CLK 13       // SPI Clock, shared with SD card
//#define MISO 12      // Input data, from VS1053/SD card
//#define MOSI 11      // Output data, to VS1053/SD card
// Connect CLK, MISO and MOSI to hardware SPI pins. 
// See http://arduino.cc/en/Reference/SPI "Connections"

// These are the pins used for the breakout example
#define BREAKOUT_RESET  9      // VS1053 reset pin (output)
#define BREAKOUT_CS     10     // VS1053 chip select pin (output)
#define BREAKOUT_DCS    8      // VS1053 Data/command select pin (output)
// These are the pins used for the music maker shield
#define SHIELD_RESET  -1      // VS1053 reset pin (unused!)
#define SHIELD_CS     7      // VS1053 chip select pin (output)
#define SHIELD_DCS    6      // VS1053 Data/command select pin (output)

// These are common pins between breakout and shield
#define CARDCS 4     // Card chip select pin
// DREQ should be an Int pin, see http://arduino.cc/en/Reference/attachInterrupt
#define DREQ 3       // VS1053 Data request, ideally an Interrupt pin

Adafruit_VS1053_FilePlayer musicPlayer = 
  // create breakout-example object!
  //Adafruit_VS1053_FilePlayer(BREAKOUT_RESET, BREAKOUT_CS, BREAKOUT_DCS, DREQ, CARDCS);
  // create shield-example object!
  Adafruit_VS1053_FilePlayer(SHIELD_RESET, SHIELD_CS, SHIELD_DCS, DREQ, CARDCS);
  
void setup() {
  Serial.begin(9600);
  Serial.println("Adafruit VS1053 Simple Test");

  if (! musicPlayer.begin()) { // initialise the music player
     Serial.println(F("Couldn't find VS1053, do you have the right pins defined?"));
     while (1);
  }
  Serial.println(F("VS1053 found"));
  
  SD.begin(CARDCS);    // initialise the SD card
  
  // Set volume for left, right channels. lower numbers == louder volume!
  musicPlayer.setVolume(20,20);

  // Timer interrupts are not suggested, better to use DREQ interrupt!
  //musicPlayer.useInterrupt(VS1053_FILEPLAYER_TIMER0_INT); // timer int

  // If DREQ is on an interrupt pin (on uno, #2 or #3) we can do background
  // audio playing
  musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT);  // DREQ int
  
  // Play one file, don't return until complete
  Serial.println(F("Playing track 001"));
  musicPlayer.playFullFile("track001.mp3");
  // Play another file in the background, REQUIRES interrupts!
  Serial.println(F("Playing track 002"));
  musicPlayer.startPlayingFile("track002.mp3");
}

void loop() {
  // File is playing in the background
  if (musicPlayer.stopped()) {
    Serial.println("Done playing music");
    while (1);
  }
  if (Serial.available()) {
    char c = Serial.read();
    
    // if we get an 's' on the serial console, stop!
    if (c == 's') {
      musicPlayer.stopPlaying();
    }
    
    // if we get an 'p' on the serial console, pause/unpause!
    if (c == 'p') {
      if (! musicPlayer.paused()) {
        Serial.println("Paused");
        musicPlayer.pausePlaying(true);
      } else { 
        Serial.println("Resumed");
        musicPlayer.pausePlaying(false);
      }
    }
  }

  delay(100);
}

The problem was, missing the code to start the music player. Now I have the music player playing the sounds on button pushes but not quiet the way I expected. At the moment I have three buttons set up for testing purposes. Button one connected to pin 14 which updates arr [0]. Button two connected to pin 15 which updates arr [1] and button 3 attached to pin 26 which updates arr [12]. When button on pin 14 is pushed music player plays itchy000.mp3. When button on pin 15 is pushed music player plays homer000.mp3. When button on pin 26 is pushed music player plays homer000.mp3.
This is what I expect to happen.
push button on pin 15 then button on pin 26. I should hear 1st button push, homer000 sound, 2nd button homer000 sound followed then by excell00 sound. (As these match)
Except I hear! button 1 homer000, failure00, button 2 homer000, homer000. (NO excell00 sound and homer00 is repeated twice on the 2nd button push)
This is what I expect to happen.
push button on pin 26 then button on pin 15. I should hear 1st button, homer000 sound, 2nd button homer000 sound followed then by excell00 sound. (As these match)
Except I hear! Except I hear! 1st button push homer000, homer000, button 2 push I hear homer000 then excell00. (Nearly correct except for homer repeated twice when pin 26 is activated.
This is what I expect to happen.
Push button on pin 26 then button on pin 14. Should hear on 1st button homer00 then on 2nd button itchy000 then failure00 sound. (Buttons do not match,)
This is what happens.
1st button push homer000, homer000, 2nd button push, itchy000. (NO failure sound.)
So why does the homer sound play twice on pin 26? Why does pin 15 play homer and failure sound?
Why is there no failure sound when pin 26 and 14 are activated?

***************************************************
  This is an example for the Adafruit VS1053 Codec Breakout

  Designed specifically to work with the Adafruit VS1053 Codec Breakout
  ----> https://www.adafruit.com/products/1381

  Written by Limor Fried/Ladyada for Adafruit Industries.
  BSD license, all text above must be included in any redistribution
 ****************************************************/

// include SPI, MP3 and SD libraries
#include <SPI.h>
#include <Adafruit_VS1053.h>
#include <SD.h>
// These are the pins used for the music maker shield
#define SHIELD_RESET  -1      // VS1053 reset pin (unused!)
#define SHIELD_CS     7      // VS1053 chip select pin (output)
#define SHIELD_DCS    6      // VS1053 Data/command select pin (output)
#define CARDCS 4     // Card chip select pin
#define DREQ 3       // VS1053 Data request, ideally an Interrupt pin

Adafruit_VS1053_FilePlayer musicPlayer =
  // create shield-example object!
  Adafruit_VS1053_FilePlayer(SHIELD_RESET, SHIELD_CS, SHIELD_DCS, DREQ, CARDCS);
//Each pin has a switch to activate it. switchPin 15 (arr 1) makes a pair with switch 26 (arr 12). When each is pressed music player plays "homer000.mp3" and
//if both pressed music player than plays "excell00.mp3.
//If the switches do not match musicPlayer needs to play "failure01.mp3".
int switchPins[] = {14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 53, A8, A9, A10, A11, A12, A13, A14, A15};
int pinCount = 45;
bool arr[44];//variable to hold what switches were pressed
int switchOpenedCount = 45;
char* simpsonSounds [] = {"itchy000.mp3", "homer000.mp3", "willy000.mp3", "arpu0000.mp3", "itchy000.mp3", "mrburns0.mp3", "bart0000.mp3", "wigam000.mp3", "wigam000.mp3", "flanders.mp3", "lisa0000.mp3", "marg0000.mp3", "homer000.mp3", "marg0000.mp3", "lisa0000.mp3", "krusty00.mp3", "snowball.mp3", "itchy000.mp3", "maggie00.mp3", "nelson00.mp3", "milhouse.mp3", "milhouse.mp3", "nelson00.mp3",
                          "grandpa0.mp3", "snowball.mp3", "santa000.mp3", "bart0000.mp3", "maggie00.mp3", "milhouse.mp3", "krusty00.mp3", "grandpa0.mp3", "bartman0.mp3", "bartman0.mp3", "flanders.mp3", "santa000.mp3", "willy000.mp3", "fink0000.mp3", "mrburns0.mp3", "ralph000.mp3", "ralph000.mp3", "fink0000.mp3", "hans0000.mp3", "hans0000.mp3", "arpu0000.mp3", "itchy000.mp3",
                         };
//There are two other files on the card   excell00.mp3 and failure0.mp3 not part of the above array.
void setup() {
  SD.begin(CARDCS);    // initialise the SD card
  if (! musicPlayer.begin()) { // initialise the music player
    Serial.println(F("Couldn't find VS1053, do you have the right pins defined?"));
    while (1);
  }
  Serial.begin(9600);
  Serial.println(F("VS1053 found"));
  // Set volume for left, right channels. lower numbers == louder volume!
  musicPlayer.setVolume(20, 20);

  // Timer interrupts are not suggested, better to use DREQ interrupt!
  //musicPlayer.useInterrupt(VS1053_FILEPLAYER_TIMER0_INT); // timer int

  // If DREQ is on an interrupt pin (on uno, #2 or #3) we can do background
  // audio playing
  //musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT);  // DREQ int

  for (int thisPin = 0; thisPin < pinCount; thisPin++) {
    pinMode(switchPins[thisPin], INPUT_PULLUP);
  }
  //turns all bool arr to false.
  for (int switchOpen = 0; switchOpen < switchOpenedCount; switchOpen++) {
    arr[switchOpen] = false;
  }

}

void loop() {
  int sensorValue = arr[1];//Used to test if button on pin 15 is registering the push.
  Serial.println(sensorValue);
  for (int thisPin = 0; thisPin < pinCount; thisPin++)
  {
    if (digitalRead(switchPins[thisPin]) == LOW)
    { arr[thisPin] = true;
      musicPlayer.playFullFile(simpsonSounds[thisPin]);



    }
  }
  //Repeat this logic for every pair of switches.
  if (arr[1] == true)
  {
    if (arr[12] == true)
    { musicPlayer.playFullFile("excell00.mp3");
      //set doors/arr back to false
      for (int switchOpen = 0; switchOpen < switchOpenedCount; switchOpen++) {
        arr[switchOpen] = false;
      }
    }
    else
    {
      for (int thisPin = 0; thisPin < pinCount; thisPin++)
      {
        if (thisPin != 1 && thisPin != 12 && arr[thisPin] == true)
        { //doors do not match so play 'wrong' sound.
          musicPlayer.playFullFile("failure0.mp3");
          //set arr/doors back to false
          for (int switchOpen = 0; switchOpen < switchOpenedCount; switchOpen++) {
            arr[switchOpen] = false;


          }
        }
      }
    }

    if (arr[12] == true)
    {
      if (arr[1] == true)
      { //doors match so play success sound
        musicPlayer.playFullFile("excell00.mp3");
        //set doors/arr back to false
        for (int switchOpen = 0; switchOpen < switchOpenedCount; switchOpen++) {
          arr[switchOpen] = false;
        }
      }
      else
      {
        for (int thisPin = 0; thisPin < pinCount; thisPin++)
        {
          if (thisPin != 12 && thisPin != 1 && arr[thisPin] == true)
          { //doors do not match so play 'wrong' sound.
            musicPlayer.playFullFile("failure0.mp3");
            //set arr/doors back to false
            for (int switchOpen = 0; switchOpen < switchOpenedCount; switchOpen++) {
              arr[switchOpen] = false;


            }
          }
        }
      }
    }
  }
}

Fixed the homer00 sound playing twice on a single button press. I debounced the button and this part works fine. I took out all the arguments and logic so all I had was a button push updating the arrays then the musicPlayer playing the correct sound. This works. I press a button and the correct sound plays. So I am sure it is my logic or arguments that are causing the problems.

You need to keep re posting the code as you change it if you want specific help.

Hi all,
This is an example using just 3 buttons. In the game I will use 45.
I have a button attached to pin 14 which when pushed should update bool arr [0] to true then a music file called itchy000.mp3 plays
I have a button attached to pin A15 which when pushed should update bool arr [44] to true then a music file called itchy000.mp3 plays.
I have a button attached to pin 15 which when pushed should update bool arr [1] to true then a music file homer000.mp3 plays.
I have the serial monitor set to read the values of bool arr [0]. Not sure how to put the values of multiple arr on to the monitor. (At the moment I have to change the code for each switch I want to read).
This is what is meant to happen. You activate the switch on pin 14 and itchy sound plays. Then you activate the switch on pin A15 and itchy sound plays. Because two sounds are the same another sound called excell00 plays. The bool arr are then all set back to false ready for the next two push sequence.
If however you activate pin 14 "itchy" plays but then activate pin 15 homer plays, the sounds do not match and then a failure sound plays. Bool arr is set back to false.
This is what actually happens.
Serial monitor reads that the VS1053 found then displays 0. (so far so good!)
I activate pin 14, I hear itchy sound, the serial monitor reads 1.
I activate pin A15, I hear the itchy sound but no excellent sound. The monitor stays on 1. (It should have returned to 0 so I changed the serial monitor to read arr [44] and repeat the sequence but the value on the monitor stays 0. I assume this is why I do not hear the excellent sound as the arr is not being updated.)
I activate pin 14, I hear itch sound. I then activate pin 15 I hear the homer sound but then hear excellent when I should hear failure. I look at the value in [1] and it stays on 0 after pin 15 has been activated.
I assume all my problems are caused by arr not updating on the pin activation.

/***************************************************
  This is an example for the Adafruit VS1053 Codec Breakout

  Designed specifically to work with the Adafruit VS1053 Codec Breakout
  ----> https://www.adafruit.com/products/1381

  Written by Limor Fried/Ladyada for Adafruit Industries.
  BSD license, all text above must be included in any redistribution
 ****************************************************/

// include SPI, MP3 and SD libraries
#include <SPI.h>
#include <Adafruit_VS1053.h>
#include <SD.h>

// These are the pins used for the music maker shield
#define SHIELD_RESET  -1      // VS1053 reset pin (unused!)
#define SHIELD_CS     7      // VS1053 chip select pin (output)
#define SHIELD_DCS    6      // VS1053 Data/command select pin (output)
#define CARDCS 4     // Card chip select pin
// DREQ should be an Int pin, see http://arduino.cc/en/Reference/attachInterrupt
#define DREQ 3       // VS1053 Data request, ideally an Interrupt pin

Adafruit_VS1053_FilePlayer musicPlayer =
  // create shield-example object!
  Adafruit_VS1053_FilePlayer(SHIELD_RESET, SHIELD_CS, SHIELD_DCS, DREQ, CARDCS);
int switchPins[] = {14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 53, A8, A9, A10, A11, A12, A13, A14, A15};
//Each pin has a switch to activate it. switchPin 15 (array 1)makes a pair with switchPin 26 (array 12)
//if both pressed music player than plays "excell00.mp3.
//If the switches do not match musicPlayer needs to play "failure01.mp3".
int pinCount = 45;
bool arr[44];//variable to hold what switches were pressed
int switchOpenedCount = 45;
char* simpsonSounds [] = {"itchy000.mp3", "homer000.mp3", "willy000.mp3", "arpu0000.mp3", "itchy000.mp3", "mrburns0.mp3", "bart0000.mp3", "wigam000.mp3", "wigam000.mp3", "flanders.mp3", "lisa0000.mp3", "marg0000.mp3", "homer000.mp3", "marg0000.mp3", "lisa0000.mp3", "krusty00.mp3", "snowball.mp3", "itchy000.mp3", "maggie00.mp3", "nelson00.mp3", "milhouse.mp3", "milhouse.mp3", "nelson00.mp3",
                          "grandpa0.mp3", "snowball.mp3", "santa000.mp3", "bart0000.mp3", "maggie00.mp3", "milhouse.mp3", "krusty00.mp3", "grandpa0.mp3", "bartman0.mp3", "bartman0.mp3", "flanders.mp3", "santa000.mp3", "willy000.mp3", "fink0000.mp3", "mrburns0.mp3", "ralph000.mp3", "ralph000.mp3", "fink0000.mp3", "hans0000.mp3", "hans0000.mp3", "arpu0000.mp3", "itchy000.mp3",
                         };
uint8_t debounceRead(int pin)
{
  uint8_t pinState = digitalRead(pin);
  uint32_t timeout = millis();
  while ((millis() - timeout) < 10)
  {
    if (digitalRead(pin) != pinState)
    {
      pinState = digitalRead(pin);
      timeout = millis();
    }
  }
  return pinState;
}
//There are two other files on the card   excell00.mp3 and failure0.mp3 not part of the above array.
void setup() {
  SD.begin(CARDCS);    // initialise the SD card
  if (! musicPlayer.begin()) { // initialise the music player
    Serial.println(F("Couldn't find VS1053, do you have the right pins defined?"));
    while (1);
  }
  Serial.begin(9600);
  Serial.println(F("VS1053 found"));
  // Set volume for left, right channels. lower numbers == louder volume!
  musicPlayer.setVolume(20, 20);

  // Timer interrupts are not suggested, better to use DREQ interrupt!
  //musicPlayer.useInterrupt(VS1053_FILEPLAYER_TIMER0_INT); // timer int

  // If DREQ is on an interrupt pin (on uno, #2 or #3) we can do background
  // audio playing
  //musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT);  // DREQ int

  for (int thisPin = 0; thisPin < pinCount; thisPin++)  {
    pinMode(switchPins[thisPin], INPUT_PULLUP);
}
//turns all bool arr to false.
for (int switchOpen = 0; switchOpen < switchOpenedCount; switchOpen++) {
  arr[switchOpen] = false;
}



// Set volume for left, right channels. lower numbers == louder volume!
musicPlayer.setVolume(20, 20);

}

void loop() {
  int sensorValue = arr[1];//Used to test if button on pin 15 is registering the push.
  Serial.println(sensorValue);

  for (int thisPin = 0; thisPin < pinCount; thisPin++)
  {
    if (debounceRead(switchPins[thisPin]) == LOW)
    { arr[thisPin] = true;
      musicPlayer.playFullFile(simpsonSounds[thisPin]);


    }
  }
  //Repeat this logic for every pair of switches
  if (arr[0] == true)
  {
    if (arr[44] == true)
    { musicPlayer.playFullFile("excell00.mp3");
      //set arr back to false ready for next sequence of two button presses
      for (int switchOpen = 0; switchOpen < switchOpenedCount; switchOpen++) {
        arr[switchOpen] = false;
      }
    }
    else
    {
      for (int thisPin = 0; thisPin < pinCount; thisPin++)
      {
        if (thisPin != 0 && thisPin != 44 && arr[thisPin] == true)
        { //doors do not match so play 'wrong' sound.
          musicPlayer.playFullFile("failure0.mp3");
          //set arr back to false
          for (int switchOpen = 0; switchOpen < switchOpenedCount; switchOpen++) {
            arr[switchOpen] = false;


          }
        }
      }
    }
  }
  if (arr[44] == true)
  {
    if (arr[0] == true)
    { //doors match so play success sound
       musicPlayer.playFullFile("excell00.mp3");
      //set doors/arr back to false
      for (int switchOpen = 0; switchOpen < switchOpenedCount; switchOpen++) {
        arr[switchOpen] = false;
      }
    }
    else
    {
      for (int thisPin = 0; thisPin < pinCount; thisPin++)
      {
        if (thisPin != 44 && thisPin != 0 && arr[thisPin] == true)
        { //doors do not match so play 'wrong' sound.
          musicPlayer.playFullFile("failure0.mp3");
          //set arr/doors back to false
          for (int switchOpen = 0; switchOpen < switchOpenedCount; switchOpen++) {
            arr[switchOpen] = false;


          }
        }
      }
    }
  }

}








/code]

It works!!!! Finally the game I am developing works. Thank you to Rick at Adafruit, Grumpy_Mike, CrossRoads, Frank609 and Arduino community for all your help and assistance. I have posted the code below to all who are interested. On to the next project......Zombie Target Game!!!

/***************************************************
  This is an example for the Adafruit VS1053 Codec Breakout

  Designed specifically to work with the Adafruit VS1053 Codec Breakout
  ----> https://www.adafruit.com/products/1381

  Written by Limor Fried/Ladyada for Adafruit Industries.
  BSD license, all text above must be included in any redistribution
 ****************************************************/

// include SPI, MP3 and SD libraries
#include <SPI.h>
#include <Adafruit_VS1053.h>
#include <SD.h>
// These are the pins used for the music maker shield
#define SHIELD_RESET  -1      // VS1053 reset pin (unused!)
#define SHIELD_CS     7      // VS1053 chip select pin (output)
#define SHIELD_DCS    6      // VS1053 Data/command select pin (output)
#define CARDCS 4     // Card chip select pin
#define DREQ 3       // VS1053 Data request, ideally an Interrupt pin

Adafruit_VS1053_FilePlayer musicPlayer =
  // create shield-example object!
  Adafruit_VS1053_FilePlayer(SHIELD_RESET, SHIELD_CS, SHIELD_DCS, DREQ, CARDCS);
//Each pin has a switch to activate it. switchPin 15 (arr 1) makes a pair with switch 26 (arr 12). When each is pressed music player plays "homer000.mp3" and
//if both pressed music player than plays "excell00.mp3.
//If the switches do not match musicPlayer needs to play "failure01.mp3".
int switchPins[] = {14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, A7, A8, A9, A10, A11, A12, A13, A14, A15};
#define pinCount (sizeof(switchPins)/sizeof(int))
bool arr[pinCount];  //variable to hold what switches were pressed

char* simpsonSounds [] = {"itchy000.mp3", "homer000.mp3", "willy000.mp3", "arpu0000.mp3", "itchy000.mp3", "mrburns0.mp3", "bart0000.mp3", "wigam000.mp3", "wigam000.mp3", "flanders.mp3", "lisa0000.mp3", "marg0000.mp3", "homer000.mp3", "marg0000.mp3", "lisa0000.mp3", "krusty00.mp3", "snowball.mp3", "itchy000.mp3", "maggie00.mp3", "nelson00.mp3", "milhouse.mp3", "milhouse.mp3", "nelson00.mp3",
                          "grandpa0.mp3", "snowball.mp3", "santa000.mp3", "bart0000.mp3", "maggie00.mp3", "milhouse.mp3", "krusty00.mp3", "grandpa0.mp3", "bartman0.mp3", "bartman0.mp3", "flanders.mp3", "santa000.mp3", "willy000.mp3", "fink0000.mp3", "mrburns0.mp3", "ralph000.mp3", "ralph000.mp3", "fink0000.mp3", "hans0000.mp3", "hans0000.mp3", "arpu0000.mp3", "itchy000.mp3",
                         };

int doorPairs[][2] = {{0, 44}, {1, 12}, {2, 35},{3,43}, {4, 17}, {5, 37}, {6, 26}, {7, 8}, {9, 33}, {10, 14}, {11, 13}, {15,29}, {16, 24}, {18, 27}, {19, 22}, {21,28}, {23, 30}, {25, 34}, {31, 32}, {36, 40}, {38, 39}, {41, 42}};
#define NUM_PAIRS (sizeof(doorPairs)/sizeof(int))/2


//There are two other files on the card   excell00.mp3 and failure0.mp3 not part of the above array.
void setup() {
  Serial.begin(9600);
  
  SD.begin(CARDCS);    // initialise the SD card

   if (! musicPlayer.begin()) { // initialise the music player
     Serial.println(F("Couldn't find VS1053, do you have the right pins defined?"));
     while (1);
  }
  Serial.println(F("VS1053 found"));

  // Set volume for left, right channels. lower numbers == louder volume!
  musicPlayer.setVolume(20, 20);
  musicPlayer.playFullFile("simpsons.mp3");

  // Timer interrupts are not suggested, better to use DREQ interrupt!
  //musicPlayer.useInterrupt(VS1053_FILEPLAYER_TIMER0_INT); // timer int

  // If DREQ is on an interrupt pin (on uno, #2 or #3) we can do background
  // audio playing
  musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT);  // DREQ int
  for (int thisPin = 0; thisPin < pinCount; thisPin++) {
    pinMode(switchPins[thisPin], INPUT_PULLUP);
  }

}

int doorCount = 0;  //number of open doors
int door1 = -1;
int door2 = -1;

void loop() {
  

  for (int thisPin = 0; thisPin < pinCount; thisPin++)
  {
    if (debounceRead(switchPins[thisPin]) == LOW)
    { 
      if (door1 == -1)
      {
        door1 = thisPin;
        doorCount++;
        musicPlayer.playFullFile(simpsonSounds[thisPin]);
        Serial.print("door1 = "); Serial.println(thisPin);
      }
      else
      {
        if (thisPin != door1)
        {
          door2 = thisPin;
          doorCount++;
          musicPlayer.playFullFile(simpsonSounds[thisPin]);
          Serial.print("door2 = "); Serial.println(thisPin);
        }
      }
    }
  }

  if (doorCount == 2)
  {
    bool success = false;  //assume the worst
    
    for (int pair = 0; pair < NUM_PAIRS; pair++)
    {
      //check pairing
      if (((door1 == doorPairs[pair][0]) && (door2 == doorPairs[pair][1]))
        || ((door2 == doorPairs[pair][0]) && (door1 == doorPairs[pair][1])))
      {
        success = true;  //valid pair found
      }
    }
  
    
    if (success)
    {
      musicPlayer.playFullFile("excell00.mp3");
      Serial.print("paired! ( "); Serial.print(door1); Serial.print(", "); Serial.print(door2); Serial.println(")");
    }
    else
    {
      musicPlayer.playFullFile("failure0.mp3");
      Serial.print("failed! ( "); Serial.print(door1); Serial.print(", "); Serial.print(door2); Serial.println(")");
    }
    door1 = -1;
    door2 = -1;
    doorCount = 0;
  }
}

uint8_t debounceRead(int pin)
{
  uint8_t pinState = digitalRead(pin);
  uint32_t timeout = millis();
  while ((millis() - timeout) < 10)
  {
    if (digitalRead(pin) != pinState)
    {
      pinState = digitalRead(pin);
      timeout = millis();
    }
  }

  return pinState;
}

[/code]