I'm using SimpleSDaudio (http://www.hackerspace-ffm.de/wiki/index.php?title=SimpleSDAudio) to play wav files. The connections are as follows:

MISO pin 12

SCK pin 13

SS pin 4

MOSI pin 11

Speaker pin 9

 Simple SD Audio bare minimum example, plays file EXAMPLE.AFM from root folder of SD card.

 This example shows how to use the SimpleSDAudio library for audio playback.
 You need: 
 - An Arduino with ATmega368 or better
 - An SD-Card connected to Arduinos SPI port (many shields will do)
   -> copy EXAMPLE.AFM on freshly formated SD card into root folder
 - A passive loudspeaker and resistor or better: active speakers (then stereo output will be possible)

 Audio signal output is at the following pin:
 - Arduino with ATmega328       (many non-mega Arduinos): Pin 9
 - Arduino with ATmega1280/2560 (many mega Arduinos)    : Pin 44

 Using passive speaker: 
    Audio-Pin --- -[100 Ohm resistor]- ---- Speaker ---- GND

 Using amplifier / active speaker / line-in etc.:
    Audio-Pin --||--------------[10k resistor]----+----[1k resistor]---- GND
              100nF capacitor                   to amp

 See SimpleSDAudio.h or our website for more information:

 created  20 Jan 2013 by Lutz Lisseck
#include <SimpleSDAudio.h>

void setup()
 // Open serial communications and wait for port to open:
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only

  // Using F("...") to avoid wasting RAM  
  Serial.print(F("\nInitializing SD card..."));  

  // If your SD card CS-Pin is not at Pin 4, enable and adapt the following line:
  // SdPlay.setSDCSPin(10);

    Serial.println(F("initialization failed. Things to check:"));
    Serial.println(F("* is a card is inserted?"));
    Serial.println(F("* Is your wiring correct?"));
    Serial.println(F("* maybe you need to change the chipSelect pin to match your shield or module?"));
    Serial.print(F("Error code: "));
  } else {
   Serial.println(F("Wiring is correct and a card is present.")); 

  Serial.print(F("Looking for on.wav... "));
  if(!SdPlay.setFile("hi.wav")) {
    Serial.println(F(" not found on card! Error code: "));
  } else {

  Serial.print(F("Playing... ")); 
  while(!SdPlay.isStopped()) {
    ;   // no worker needed anymore :-)

void loop(void) {


The problem is when playing the wav files. It plays with a lot of static. I've tried adding a 1k resistor between the speaker and gnd but that just lowered the overall volume. I resampled the wav files in itunes to 32khz, 8bit, mono. If I lower to 16khz then the audio volume becomes very low and the song just plays extremely fast. Here is a google drive link to one of the sounds: https://drive.google.com/file/d/0B3yAl4G-mcC4dlppN3dtczJvT1k/view?usp=sharing

I really need help. I'm not sure what to do!

  • Is that sample a source sound or a playback recording? I don't hear any static in it. Apr 20 '16 at 3:08
  • Have you read the documentation in that link you provide? Especially the bit about converting the WAV files to 8-bit mono raw files prior to use?
    – Majenko
    Apr 20 '16 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.