Go Down

Topic: wav files not playing on nano (Read 3476 times) previous topic - next topic


I'm trying to play sound files from my nano, but nothing comes out of the speakers except for a faint pop, and then nothing.   Here is my code:  

Code: [Select]
#include <TMRpcm.h>
#include <SD.h>

TMRpcm audio;

void setup() {
 Serial.print(F("\nInitializing SD card..."));
 if (!SD.begin(10)) {

 audio.speakerPin = 9;

void loop() {

This is what my breadboard looks like:

the speaker I'm using:

the SD card reader I'm using:

IC I'm using:

tmrpcm library page:

Any ideas on how I can troubleshoot where the problem is?  I was mostly following this guy's tutorial:
the serial monitor says the card initialized properly, so what could be the problem?


Could the file format be wrong? 

"Main formats: WAV files, 8-bit, 8-32khz Sample Rate, mono."
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp


this is what I'm trying to play:


That looks right to me, unless "PCM" describes something other than raw samples.

Have you tried it on a UNO?
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp


There are no differences between the Uno/Nano/Pro Micro.

When are you people going to learn?


I tried it on an UNO yesterday in an act of desperation. No change.  A faint pop maybe, but other than that, nothing.


Does the PCM library return any sort of useful error if it can't find the specified file?  Perhaps there is something wrong with the formatting of the SD card.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp


not with the TMRpcm library, but when I tried to use the Simple SD Audio library (http://www.hackerspace-ffm.de/wiki/index.php?title=SimpleSDAudio) it returns an error code 8 which means "card returned an error response for CMD17 (read single block)".

The software I'm using to format my card is https://www.sdcard.org/downloads/formatter_4/

The options available under format type are quick, full(erase) and full(overwrite). (I've been using erase or overwrite)
The options under format size adjustment are on or off.

I'm not really sure what the format size adjustment is, or the difference between full(erase) and full(overwrite), other than overwrite takes a lot longer to finish.


this error is an indication that something is wrong with your SD card, your level-shifters or your wiring to the card. Have you set up the correct SD-ChipSelect pin in your code? It is done differently (#define in TMRpcm, setSDCSPin() in SimpleSDAudio). Maybe the level-shifter you picked is too slow for the operation - try to do something different, often the simple resistor dividers shown on the SimpleSDAudio website work pretty well.

Go Up