TMRpcm outputting cracking/noise

Good evening!

a tricky one (or maybe not, if you've been through the same already).
I am struggling since days to get TMRPCM to play back some simple WAV from SD through an UNO. I am trying to rebuild this gentlemen's escape room phone prop. Dialing and hook lifting/dropping works but it is not playing back the audio as expected.

Problem
When playing back the sound I am getting either nothing at all or a weird cracking / nonsense noise output.
"#define debug" enabled in pcmConfig.h returns "WAV ERR" despite using demo files and demo code.

Code
"basic_test" from the TMRPCM library example:

#include <SD.h>                   
#define SD_ChipSelectPin 4  
#include <TMRpcm.h>           
#include <SPI.h>

TMRpcm tmrpcm;  

void setup(){

  tmrpcm.speakerPin = 9 ; //5,6,11 or 46 on Mega, 9 on Uno, Nano, etc

  Serial.begin(9600);
  if (!SD.begin(SD_ChipSelectPin)) {  
    Serial.println("SD fail");  
    return;   
  }
     tmrpcm.play("music"); 
}



void loop(){  

  if(Serial.available()){    
    if(Serial.read() == 'p'){ //send the letter p over the serial monitor to start playback
      tmrpcm.setVolume(4);;
      tmrpcm.play("musicb");
      Serial.println(tmrpcm.isPlaying());
    }
  }

}

Hardware

  • Arduino UNO v3
  • SPI SD Card reader HW-203 and HW-125 (I guess no-name/unbranded)
  • Speaker: Old rotary dial phone (yes, seriously)

Pins

  • #4 CS
  • #9 Speaker
  • #11 MOSI
  • #12 MISO
  • #13 SCK

What I have tried so far

  • Ran the SD cardinfo demo - could list the files and received correct card info
  • Loading demo music from git repo
  • Formatting SD Card to fat32 and fat16
  • "#define DISABLE_2" in pcmConfig.h
  • "#define SDFAT" in pcmConfig.h
  • Using a SensorShield v5.0 and without
  • Using a different SD module
  • Using 3 different SD cards
  • Using another Sainsmart UNO
  • Using another Sainsmart MEGA256

Schematic

Button=pick up/hang up switch in phone

What am I missing?
Thank you for any hint!

Cheers,
André

What am I missing?

A schematic.

Pins
#9 Speaker
#11 Speaker
Don't make much sense to me. I thought this used just one pin from the Arduino, why are you attaching two speaker pins from the Arduino?

Read some good tips about using this forum here:- how to use this forum

The WAV file must be the right format for TMRPCM library. But if you're using demo files that should be correct.
Is the SDcard getting proper power? SDcards are power hungry and built-in 3.3V supply on many Arduinos isn't beefy enough.

Have you sanity checked just reading files from the card direct?

Speaker: Old rotary dial phone (yes, seriously)

About the least likely transducer I can imagine, and I know what they are like, probably going to make abysmal sound quality. They involve a steel diaphram in the field of an electromagnet with a permanent magnet bias and have very low output for the input level (basically an earphone).

Grumpy_Mike:
A schematic.

Pins
#9 Speaker
#11 Speaker
Don't make much sense to me. I thought this used just one pin from the Arduino, why are you attaching two speaker pins from the Arduino?

Read some good tips about using this forum here:- how to use this forum

Thanks, schematic added and pin 11 fixed to MOSI!

Thank you for your reply!

MarkT:
The WAV file must be the right format for TMRPCM library. But if you're using demo files that should be correct.
Is the SDcard getting proper power? SDcards are power hungry and built-in 3.3V supply on many Arduinos isn't beefy enough.

I am running the SD reader off the 5V pins, supply is via USB. Will try to power the whole contraption by an external power supply.

MarkT:
Have you sanity checked just reading files from the card direct?

Good point, I will try reading file content to serial. The SD "cardinfo" example works fine and returns info + all file names on the card to serial.

MarkT:
About the least likely transducer I can imagine, and I know what they are like, probably going to make abysmal sound quality. They involve a steel diaphram in the field of an electromagnet with a permanent magnet bias and have very low output for the input level (basically an earphone).

I do not expect much quality either... but in the original video linked in my post you can hear quite a decent output. In my case the UNO outputs enough juice to make a very loud and unplesent noise/scramble.

aueberbach:
Thank you for your reply!

I am running the SD reader off the 5V pins, supply is via USB. Will try to power the whole contraption by an external power supply.

If its a module with its own 3.3V regulator, that's fine. You can get a bare SDcard socket which then needs this added.

Good point, I will try reading file content to serial. The SD "cardinfo" example works fine and returns info + all file names on the card to serial.

I do not expect much quality either... but in the original video linked in my post you can hear quite a decent output. In my case the UNO outputs enough juice to make a very loud and unplesent noise/scramble.

You need to boost a logic signal before if can drive any loudspeaker type except piezo.

I got it to work... looks like formatting the SD card to fat16 on macOS did mess up the file system. Formatted with Win10, downloaded the demo wav again and it worked.

MarkT:
You need to boost a logic signal before if can drive any loudspeaker type except piezo.

In this case arduino output themes to be sufficient. Volume is great, audio quality as expected but good enough for my purpose.

Thanks for your help everyone!