Go Down

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

DavidFMarks

That's great, many thanks.. I'll have a crack at it

DavidFMarks

Been studying the demo sketch and can see roughly what bit is doing. I am trying to find out how to issue a serial command from within the program (rather than via the serial monitorto select and play a file. I'm afraid I am very new to Arduino and am perhaps taking on too much here but I just cant see how to do it.

Tuttut

Hi folks, good news from me:  8)
I've updated the library and now you don't need to call worker() anymore if you provide the SSDA_MODE_AUTOWORKER flag at initialization. I've also added a doorbell (with ding-dong-sound) example, the SD card file access example and edited the examples for autoworker-function. Also there is the fancy AbsoluteMinimum-Example to play the example-audio-file from card that contains just this:
Code: [Select]

/*
SimpleSDAudio absolute minimum example, plays file EXAMPLE.AFM from root folder of SD card (CS on pin 4)
through speaker/amplifier at pin 9 for ATmega328 / pin 44 for ATmega1280/2560.
*/
#include <SimpleSDAudio.h>
void setup()
{
  // SdPlay.setSDCSPin(10); // Enable if your SD card CS-Pin is not at Pin 4...
  SdPlay.init(SSDA_MODE_FULLRATE | SSDA_MODE_MONO | SSDA_MODE_AUTOWORKER);
  SdPlay.setFile("EXAMPLE.AFM");
  SdPlay.play();
}

void loop(void) {
}


Enjoy!

xl97

nice job..

(for those lazy.. here is the link to the lib:  http://hackerspace-ffm.de/wiki/index.php?title=SimpleSDAudio#Download)

  So using what you've posted.. all you need to do in the MAIN loop..

for a button 'check/press' is:


(dummy code:)

Code: [Select]
if(digitalread(button1) == LOW){
     SdPlay.setFile("EXAMPLE2.AFM");
     SdPlay.play();
}else if(digitalread(button2) == LOW){
     SdPlay.setFile("EXAMPLE3.AFM");
     SdPlay.play();
}


etc..etc..

no need to init or de-init anything?

the more demos showing all the functions and features make for popular usage!!..

I still have gotten to the 2/4 channel stuff I saw mention.. or how all that works!  lol..

(side question and really more a general hardware questions.. is there any other things we can add to the single output on D9 to make it sound a bit better?..  I only have a 100uF cap right now.. no resistors any thing)..

I dont/wont have enough room to have a pot/wiper and a ton of extra components.. but if adding another cap or resistor or two will help improve..  Id like to try!).. I saw some examples use a resistor.. and some use only a cap..etc.


tack

@Tuttut, did you see my post at #84 about use on the 1284P? Thanks.

Go Up