Sparkfun MP3Shield woulnd't play songs in a row

Hey,

it’s my very first time by using a MP3shield.
I think i have a tiny understanding problem… please help :-[

My Problem:
I want that my Shield plays a couple of tracks one after another.
I’ve tried timed delays between my tracks, but it won’t play more than two of them…

My Code:

//Include libraries in the sketch
#include <SPI.h>
#include <SdFat.h>
#include <SdFatUtil.h>
#include <SFEMP3Shield.h>

SdFat sd;
SFEMP3Shield MP3player;

void setup(){
  Serial.begin(9600);
  //Setup MP3 shield
  if(!sd.begin(SD_SEL, SPI_HALF_SPEED)) sd.initErrorHalt();
  if(!sd.chdir("/")) sd.errorHalt("sd.chdir");  
  MP3player.begin();
  MP3player.setBitRate(192);
  MP3player.setVolume(10,10); 
}
void loop(){
  MP3player.playTrack(12);
  delay(500);
  MP3player.playTrack(11);
  delay(500);
  MP3player.playTrack(4);
  delay(500);
}

Thanks ahead
Aleshanee :smiley_cat:

aleshanee:

void loop(){

MP3player.playTrack(12);
 delay(500);
 MP3player.playTrack(11);
 delay(500);
 MP3player.playTrack(4);
 delay(500);
}

Just a guess: The player plays tracks in the background and you cannot play an unlimited number of tracks at the same time. So perhaps you have to wait until one track is finished playing before you can start another.

  MP3player.playTrack(12);
  while (MP3player.getState() == playback)) ;
  delay(500);
  MP3player.playTrack(11);
  while (MP3player.getState() == playback)) ;
  delay(500);
  MP3player.playTrack(4);
  while (MP3player.getState() == playback)) ;
  delay(500);

P.S.: I don't know the board, but I've had a look in the example program https://github.com/madsci1016/Sparkfun-MP3-Player-Shield-Arduino-Library/blob/master/SFEMP3Shield/Examples/FilePlayer/FilePlayer.ino and the example program doesn't look like playing multiple tracks at the same time.

So it's just a guess.