Music with Music Shield

Hi, I’m programming a musical doorbell usign the music shield and I’m a little stuck.
I’ve managed to play songs inserted with a SD card. The problem is that I don’t know how I can program it to stop the song at the moment I want it. That is, I want the song to play only for 30 seconds.

I’m a bit blocked, thanks in advance for the help.

#include <SD.h>
#include <SPI.h>
#include <arduino.h>
#include <MusicPlayer.h>

void setup()
 player.begin();  //will initialize the hardware and set default mode to be normal.
void loop()
{;  //do some leisurely job

Check your documentation for the particular audio shield to see if there's a stop command. Then use delay() or make a millis() timer.

Hi, I'm programming a musical doorbell

Or, use Audacity or MP3directCut to make some 30-second audio files. (And, if you're editing the song to make it shorter, you want to make a fade-out.)

Yes, de library have some comands to stop and resume, for example, but I don’t know how to writte them in the program. These are de comands that the library include:

– operate APIs –
void play(void)
void opPlay(void)
void opPause(void)
void opResume(void)
void opStop(void)
void opVolumeUp(void)
void opVolumeDown(void)
void opNextSong(void)
void opPreviousSong(void)
void opFastForward(void)
void opFastRewind(void)

Thanks for your help!