In this waveplayer, the wave file will be keep looping after the waiting time. For the wave file, my format is 11khz 8bit mono. You might need to have a op-amp across the mbed and speaker as the signal will be very small

Dependencies:   mbed wave_player

main.cpp

Committer:
daryl2110
Date:
2011-11-22
Revision:
0:e0d156143789

File content as of revision 0:e0d156143789:

#include "mbed.h"
#include "wave_player.h"

LocalFileSystem local("loc");
AnalogOut       DACout(p18);
wave_player     waver(&DACout);

int main() {
    FILE  *fp = fopen("/loc/Hello.wav", "r");
    while (1)
    {
      waver.play(fp);
      fseek(fp, 0, SEEK_SET);  // set file poiter to beginning
      wait(3.0);
      printf("File Playing\n");
    }
    fclose(fp);
}