Hi;
Trying to play a sound without a mp3 shield. And found a way to read .wav files from SD card and send signals to speaker.
Problem is that: I connect my Arduino to a power source and speaker plays the music. But it is really fast, like breathed hellium.
Anyone who knows solution for this? Thanks a lot...
Note: Using that code:
#include <SimpleSDAudio.h>
void setup() {
SdPlay.setSDCSPin(4); // sd card cs pin
pinMode(2,OUTPUT);
digitalWrite(2,LOW);
if (!SdPlay.init(SSDA_MODE_FULLRATE | SSDA_MODE_MONO | SSDA_MODE_AUTOWORKER))
{ while(1){
 digitalWrite(2,HIGH);
 }
}
if(!SdPlay.setFile("music.wav")) // music name file
{ while(1);
 digitalWrite(2,HIGH);
}
}
void loop(void)
{
SdPlay.play(); // play music
while(!SdPlay.isStopped())
{ ;
}
}
And my wav files has this properties:
-Samples Per second (Hz): 16000
-Channel: Mono
-Bits Per Sample: 8
Try SSDA_MODE_HALFRATE instead of SSDA_MODE_FULLRATE. That should reduce the playback speed but maybe not enough to sound even close to reasonable.
If it doesn't, you may have to resample your WAV file from 16kHz up to 31.25 kHz.
kahve:
Hi;
Trying to play a sound without a mp3 shield. And found a way to read .wav files from SD card and send signals to speaker.
use TMRpcm library. it is perfectly well for playing .wav files. you can connect SD card directly to the arduino without any mp3 boards. you will get a great sound quality. keeping same specifications for the .wav file.