Go Down

Topic: Just 30 seconds? (Read 319 times) previous topic - next topic

Popcircuits

Hi,

Total noob to all of this and i dont know if i'm doing something wrong, but i can only get my arduino to play 30 seconds of any .wav file - is that the max?
Im using a 2560 mega along with a W5100 ethernet shield.

Any help would be great!

DVDdoug

How big is your WAV file?   Do you have enough memory?  I assume the WAV file is stored on an SDcard?  Can you read all of the memory you have?   (You might have to write a little memory-test program.)

There could be a bug/error in your software.   How are you playing the audio?   Are you using the TMRpcm library?

Are you only using the Ethernet shield for memory or are you using the network and playing audio at the same time?   

MarkT

Running out of RAM due to not releasing resources?
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Grumpy_Mike

Or input buffer pointer exceeding the largest number that variable type can hold.

Without seeing your code we can only guess.

Popcircuits

Hi all,

It could be memory... Sometimes, the track will play for longer than 30 seconds, 2 mins maybe? but then will loop back to 30 seconds. I've no idea how to get it to release or anything.

The code I have used is...

#include "SD.h"
#define SD_ChipSelectPin 53
#include "TMRpcm.h"
#include "SPI.h"

TMRpcm audio;

void setup(){
audio.speakerPin = 46;
Serial.begin(9600);
if (!SD.begin(SD_ChipSelectPin)) {
Serial.println("SD fail");
return;
}

audio.setVolume(2);
audio.play("2.wav");
audio.quality(1);

 
}
void loop(){  }


I have tried using a different SD card reader by MK, instead of a shield, but it makes no difference. At least I know the parts aren't faulty.

I have tried it with a couple of different tracks and the problem is the same.

The Arduino reports that the "Sketch uses 12418 bytes (4%) of program storage space. Maximum is 253952 bytes. Global variables use 1488 bytes (18%) of dynamic memory, leaving 6704 bytes for local variables. Maximum is 8192 bytes".

Once I can get it to play 1 full .wav file, my next mission is to add another .wav to play consecutively - another  headache for another time perhaps

DVDdoug

I've never used TMRpcm, but it seems odd to set the quality after you start playing.   Is that normal?

Popcircuits

The quality is just something i threw in more recently. Works just the same without that code

Popcircuits

Has anyone got any clues please?

Problem still a problem :(

Go Up