This project will use the following Arduino libraries that you will want to put into your Arduino Flora library folder:
It also uses the Arduino IDE built-in SPI bus and SD (flash SD card reader) libraries.

You should consult the Adafruit Guide All About Arduino Libraries on how to install the library code for use.

Shirriff's library is known to be well written and it is non-blocking, if there is no IR code received, you can go to do other things. It decodes nearly any remote and is widely used. But it's large: it would never fit on a Trinket or Gemma and takes a fair amount of room on our Flora. But we have the space (with 2100+ bytes to spare), so for the flexibility, it is a good fit.

If you need more space, the serial commands may be commented out. It would make debugging more difficult so consider which statements you need or not.
Download: file
/*************************************************** 
  Dr. Who TARDIS Costume Code, based on Adafruit VS1053 code. 

  Designed  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!

  Based on code 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>    // Music board library
#include <SD.h>
#include <Adafruit_NeoPixel.h>  // Neopixel Library
#include <IRremote.h>     // IR library https://github.com/shirriff/Arduino-IRremote

#define PIN       2  // Neopixel on pin D2
#define NUMPIXELS 1  // One neopixel

Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

// define the pins used
#define RESET 9      // VS1053 reset pin (output)
#define CS 10        // VS1053 chip select pin (output)
#define DCS 6        // VS1053 Data/command select pin (output)  (XDCS)
#define DREQ 3       // VS1053 Data request pin (into Arduino)
#define CARDCS 12    // Card chip select pin (SDCS)

Adafruit_VS1053_FilePlayer musicPlayer = Adafruit_VS1053_FilePlayer(RESET, CS, DCS, DREQ, CARDCS);

int RECV_PIN = 0;         // IR Receiver data line on pin D0
IRrecv irrecv(RECV_PIN);  // initialize IR Remote library
decode_results results;   // decode results variable
int8_t sound_status;      // variable to determine whether to play sound or not

void setup() {            // Initialize the hardware
  Serial.begin(9600);
  // initialise the music player
  if (!musicPlayer.begin()) {
    Serial.println("VS1053 music board not found");
    while (1);  // don't do anything more
  }

  musicPlayer.sineTest(0x44, 500);    // Let person know it's working
 
  if (!SD.begin(CARDCS)) {
    Serial.println("SD failed, or not present");
    while (1);  // don't do anything more
  }
  
  musicPlayer.setVolume(20,20);
  musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT);
     
  strip.begin();  // Initialize Neopixel library use
  strip.show();   // Initialize all pixels to 'off'
  
  irrecv.enableIRIn(); // Start the IR receiver
  sound_status = 1;    // we want sound
}

void loop() {  

  // Start playing a file, flash LED and listen to IR while playing
  if( sound_status == 1 ) {   // if we want sound on
     if (! musicPlayer.startPlayingFile("track001.mp3")) {
       Serial.print("Could not open file");
     }
     Serial.println("Started playing");
  }

  while (musicPlayer.playingMusic) {
    // file is now playing in the 'background' so now's a good time
    // to pullse the LED and look for the IR signal
    sound_and_IR();    
  }
  if( sound_status == 0 ) { // work to do even if sound is not playing
    sound_and_IR();
  }
  Serial.print("Done playing music, sound status = ");
  Serial.println(sound_status, DEC);
}

void sound_and_IR(void) {  // ths is the code that is run during a sound or if sound is turned off
    int i;
    for(i=0; i<256; i++) {
       strip.setPixelColor(0,strip.Color(0,0,i)); // cycle Blue up
       strip.show();
       delay(6);
    }
    delay(100);
    for(i=255; i>=0; i--) {
       strip.setPixelColor(0,strip.Color(0,0,i)); // cycle Blue down
       strip.show();
       delay(5);
    }
   delay(100);
   if (irrecv.decode(&results)) {     // If any code received by remote
      if( sound_status == 1 )         // if sound status is on, toggle off
         sound_status=0;   
      else                            // if sound status if off, toggle on
         sound_status=1;
      Serial.println(results.value, HEX); // Print out remote hex code
      irrecv.resume();                // Reset to receive another IR value
   }
}
This guide was first published on Oct 24, 2013. It was last updated on Oct 24, 2013. This page (Code) was last updated on Jun 12, 2019.