Go Down

Topic: TMRpcm cant open file (Read 687 times) previous topic - next topic


Aug 23, 2015, 09:39 pm Last Edit: Aug 23, 2015, 09:41 pm by AliceTheCat
im working with TMRpcm library in the last few days and it worked great till now. I cant get any .wav files to play ... I tried the basic library example but even this doesnt work. Its not an audio output problem because the library doesnt even read the SD Card. The SD card can be initialized with no problems though.

I tried to:

  • read/write on the sd card (-> SD Module is not the cause)
  • redownload the library (-> library is not the cause)
  • download an older IDE version (-> IDE is not the cause)
  • overwrite the wave files with the ones on my pc (-> wav files are not the cause)

So i took a look in the source code... Inside the function waveInfo() this get executed:

sFile = SD.open(filename)

After this line the library tests if sFile is open. It returns false and outputs "WAV ERROR".

I dont get it ... It all worked in the last days and i changed nothing. It doesnt work on my UNO and MEGA.

My code (modified library example):

Code: [Select]
#include <SD.h>                      // need to include the SD library
//#define SD_ChipSelectPin 53  //example uses hardware SS pin 53 on Mega2560
#define SD_ChipSelectPin 10  //using digital pin 4 on arduino nano 328, can use other pins
#include <TMRpcm.h>           //  also need to include this library...
#include <SPI.h>

TMRpcm tmrpcm;   // create an object for use in this sketch

void setup(){

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

  if (!SD.begin(SD_ChipSelectPin)) {  // see if the card is present and can be initialized:
    Serial.println("SD fail"); 
    return;   // don't do anything more if not

void loop(){ 



Try this:
replace: tmrpcm.play("gl");
with: tmrpcm.play("gl.WAV");

This works for the example too. It needs the extention

Go Up