EDIT: I got it working. Turns out that when working with the Mega 2560 and an ethernet shield with SD card slot, you have to disable the ethernet so that the sd card slot will be used. Apparently, both cannot be used at the same time... It was a bit quiet at first, but that was simply due too loose cables.
Example code:
#include <SD.h> // need to include the SD library
//#define SD_ChipSelectPin 53 //example uses hardware SS pin 53 on Mega2560
#define SD_ChipSelectPin 4 //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(){
// disable w5100 SPI while setting up SD
pinMode(10,OUTPUT);
digitalWrite(10,HIGH);
tmrpcm.speakerPin = 11; //5,6,11 or 46 on Mega, 9 on Uno, Nano, etc
Serial.begin(9600);
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
}
tmrpcm.volume(7);
tmrpcm.play("1.wav"); //the sound file "music" will play each time the arduino powers up, or is reset
}
void loop(){
}
That makes absolutely no sense. It's like saying "despite the dog being a cat". warning != error.
You need to understand the difference between warnings and errors. A warning is the compiler telling you there is something in the code that could possibly cause a problem but doesn't cause the compilation to fail. An error is a problem with the code that causes compilation to fail. In this case you have posted warnings not errors.
You should always pay attention to warnings and fix them in your own code whenever possible. Unfortunately some library authors don't hold themselves to such high standards so sometimes you do just need to ignore a warning from a library that you didn't write. That can be quite annoying since you are always having to sort though a bunch of warnings in other people's sloppy code to make sure your own code is of high quality. You may decide it's worth editing the source of the library to fix the warning. If you do so, it's a good idea to submit a pull request for the fix to the library's repository to solve the problem upstream, otherwise the warnings will come back whenever you update to a new release of the library. This will also benefit all the other users of the library.
The warning has nothing to do with the problem you're having. It's unfortunate that the author of the library doesn't hold their work to higher standards but you can ignore this warning if you like. Or you can fix it if it bothers you. But first I'd recommend focusing on the real problem.
If this library does not work properly, and you want to purchase a player module, I would indicate the DFplayer mini, which can play mp3, SD card, and also accepts USB, if you use a USB connector on it.