Go Down

Topic: New library for PWM playback from SD cards: SimpleSDAudio (Read 45 times) previous topic - next topic

robsmok

how to build class
play next, previous file
Please help :)

THX

robsmok

hmm
#include <SimpleSDAudio.h>
not working with
#include <SD.h>
:(

Tuttut

Hm, *looking into crystal ball*, try starting with the examples provided by the library. Use Arduino IDE V1.0.x instead of beta versions in case of build trouble.

skoubri

Great project!!! i will try it!

i am just looking not very much for quality but if possible gapless play of parts of the file or between files... don't know if possible. Want to use atmega328 or 2560

thanks!!

Tuttut

Gap-less playback from SD is always a challenge. Even the .play() function might be fast enough, at least the .setFile() function will always do a lot of searching through the FAT filesystem. First try to play the same file again and again using a loop like:

Code: [Select]

while(1) {
   if(SdPlay.isStopped()) SdPlay.play();
}


If this works ok for you, you might youself patch the library in a way that the information that is retrieved by setFile is stored somewhere in RAM and used for quicker change of the file to playback. But this might be not the right starting-project for beginners...

skoubri


Gap-less playback from SD is always a challenge. Even the .play() function might be fast enough, at least the .setFile() function will always do a lot of searching through the FAT filesystem. First try to play the same file again and again using a loop like:

Code: [Select]

while(1) {
   if(SdPlay.isStopped()) SdPlay.play();
}


If this works ok for you, you might youself patch the library in a way that the information that is retrieved by setFile is stored somewhere in RAM and used for quicker change of the file to playback. But this might be not the right starting-project for beginners...


Thank you SO MUCH for the quick answer and the tip too! ... I'll check it and come back with results..

skoubri

#201
Feb 14, 2014, 05:32 pm Last Edit: Feb 16, 2014, 09:49 am by skoubri Reason: 1
Hi again.. used the code below

Code: [Select]
while (S < 1000) {
   S=(pulseIn(13,HIGH,20000);
   if (millis()-t > 999){p=1;t=millis();
   if (p == 1) {
     SdPlay.setFile("START.AFM");
     SdPlay.play();p=0;t=millis();}

and my loop played perfect!!.. BUT now i noticed another problem with pulseIn as i am reading a PWM input to change sounds...

any tips if i can do that? is this an interrupt problem or because changes of the timers? is there anyway to measure PWM while playing sound?

Moko

Is there a way to adjust the volume?
I have a home automation including a clock with my arduino mega, and  would decrease the sound (westminster gong) in the night and set it to normal (it's loud enough) at the day.
Currently i must disable the sound in the night :(
thanks

Tuttut

Hi,
actually there is no such a feature. But usually SD cards have plenty of space - so just prepare one set of files with a lower volume (using a wav editor like Audacity) and switch between them.

Moko


Hi,
actually there is no such a feature. But usually SD cards have plenty of space - so just prepare one set of files with a lower volume (using a wav editor like Audacity) and switch between them.



Good idea. Done. Works.
Thanks...

fx3200

its possible make this with this library? http://onixarts.pl/blog/2014/01/arduino-soundcard

Go Up