I am trying to play a 16kHz, 8-bit, mono wav file i have on an SD Card though a speaker attached to my Ardunio. I know everything is wired correctly because when I test the speaker with the Tone library everything comes out fine and when I test the SD Card with the CardInfo example it is connected and my WAV file shows up. When running my code however, the WAV file is trying to play but it just sounds like static and not the WAV file that can be played through the card on the computer. Any advice on how to get this to work? Below is my code:
It would be helpful to know what shield board you're using, or if it's your own circuitry we'd like to see your schematic. My Adafruit Wave Shield needs it's own library to be compiled and loaded to play audio, and it seems like you have no DAC firmware or software functioning. If it sounds like a FAX machine or a telephone modem it's because you need that DAC to turn the digital code into an audio waveform.
If the audio comes out like static, the most likely cause is some sort of file corruption on the SD card, or a problem with the file itself. If not, then make sure the wav file is encoded correctly (16khz, 8bit, mono). Also make sure you have the most recent version: https://github.com/TMRh20/TMRpcm/archive/master.zip