A simple example of WAV playback for the RS AudioCODEC board. Uses a USB drive to stream music.

Dependencies:   FatFileSystem MSCFileSystem WavPlayer mbed

Fork of WavPlayer_test by Giles Barton-Owen

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 // This is all set up for the AudioCODEC board on the AnimatronicLAB board (RS Product Code 754-1965): Just plug a memory stick
00002 // with a wav file called test.wav on it (such as the one you can get from: https://mbed.org/media/uploads/p07gbar/test.wav) 
00003 // and have a listen! Any 16bit PCM Wav files with channel*sample rate less than 48kHz should work.
00004 
00005 #include "mbed.h"
00006 #include "WavPlayer.h"
00007 #include "MSCFileSystem.h"
00008 
00009 MSCFileSystem msc("msc"); // Mount flash drive under the name "msc"
00010 WavPlayer player;
00011 
00012 int main() {
00013     FILE *fp = fopen("/msc/test.wav", "r");  // Open "out.txt" on the local file system for writing
00014     player.open(&fp);
00015     player.play();
00016     fclose(fp);
00017 }