#include "svt.h" // As always #define AudioFile "A:\\Test\\Audio.wav" // subsitutes "AudioFile" with your file path int length = 10000;// recording length void Start() { OpenGraphics(); //we'll need the display } bool Run() { //Check if it's time to quit if (GetRemoteKeys() & KEY_HOME) return false; // display our instruction ClearScreen(); DrawText( 35, 5, "Press Go" ); DrawText( 35, 30, "to record" ); DrawText( 25,55, "%d seconds", length/1000 ); DrawText( 30, 80, " of Audio"); Show(); //wait for the keypress while (!GetRemoteKeyStatus(KEY_RUN)) { Sleep(10); } // start recording ClearScreen(); DrawText( 15, 30, "Recording" ); Show(); StartAudioRecording( AudioFile );// creates or overwrites file to write in ResetTimer(); while( ReadTimer() < length ) { Sleep( 10 );// wait while coolecting some sound WriteAudioData(); // write whatever has been recorded } StopAudioRecording(); //close recorded file // display finished message ClearScreen(); DrawText( 15, 30, "DONE" ); Show(); Sleep(1500); // display instruction ClearScreen(); DrawText( 35, 5, "Press Go" ); DrawText( 25, 30, "to playback" ); DrawText( 15,55, "Audio tecording" ); Show(); // wait for key press while (!GetRemoteKeyStatus(KEY_RUN)) { Sleep(10); } // play back file ClearScreen(); DrawText( 15, 30, "Playing" ); Show(); CloseGraphics();// free up our processor to do audio digitizing StartAudioPlayback( AudioFile ); // begin playing file // wait for audio to finish while( IsAudioPlaying() ) { Sleep( 500 ); } //report finished OpenGraphics();// open the display again ClearScreen(); DrawText( 5, 80, "DONE" ); Show(); Sleep(2000); //run again return true; } void End() { CloseGraphics(); }