Wave Shield Programming help...

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
Bea
 
Posts: 16
Joined: Fri Nov 18, 2011 2:55 pm

Wave Shield Programming help...

Post by Bea »

Ok, so I must be doing something wrong, All I want is for the wave shield to read the one audio file on my SD card and play it automatically so that I can make sure all is working correctly, how can I do this. I am using the AF_Wave library, I have the library installed in the arduino libraries folder and am using the PiSpeak sketch, what do I need to change on the PiSpeak sketch to get this to work. All help is appreciated!!!!

User avatar
adafruit_support_bill
 
Posts: 88091
Joined: Sat Feb 07, 2009 10:11 am

Re: Wave Shield Programming help...

Post by adafruit_support_bill »

Just eliminate everything in the "void loop()" function except "playcomplete(filename);" - where the filename is the name of the file you want to play.

Bea
 
Posts: 16
Joined: Fri Nov 18, 2011 2:55 pm

Re: Wave Shield Programming help...

Post by Bea »

Thanks, should the same be done if I am using the daphc file for the WaveHC ?
I also want to add pressure sensors to trigger the audio files to start and stop, then once pushed again to play the second audio file, aside from reading from the analog pins what should I be adding or changing.

User avatar
adafruit_support_bill
 
Posts: 88091
Joined: Sat Feb 07, 2009 10:11 am

Re: Wave Shield Programming help...

Post by adafruit_support_bill »

With the daphc file, the call would be "play(file);"
also want to add pressure sensors to trigger the audio files
To add pressure sensors, you wold do an analog read, then test for a threshold value to determine a button press. You will probably have to experiment a bit to find a threshold value that works best for you.
to trigger the audio files to start and stop, then once pushed again to play the second audio file
You probably want to go back to the original dapHC code and insert your button test here:

Code: Select all

       // WAIT FOR BUTTON PRESS HERE
        wave.play();                       // make some noise!
       
        while (wave.isplaying) {           // playing occurs in interrupts, so we print dots in realtime
          putstring(".");
          delay(100);
        }

Bea
 
Posts: 16
Joined: Fri Nov 18, 2011 2:55 pm

Re: Wave Shield Programming help...

Post by Bea »

Thanks. I decided to use a single button and then switch to the next audio file once it is pressed....I am using the sample code found here: http://www.ladyada.net/media/wavshield/ ... teonce.pde

How can I change the code so that rather then having 2 or 5 separate buttons, once the button is pressed again it moves to the next file, I would like to keep the playcomplete and have it only switch once the audio track currently playing is done....

Thanks for all the help.

User avatar
adafruit_support_bill
 
Posts: 88091
Joined: Sat Feb 07, 2009 10:11 am

Re: Wave Shield Programming help...

Post by adafruit_support_bill »

once the button is pressed again it moves to the next file, I would like to keep the playcomplete and have it only switch once the audio track currently playing is done....
Something like this:

Code: Select all

void waitForPress()
{
  // loop until the button is pressed
  // (inverse logic - use internal pullups)
  while(digitalRead(buttonPin) == HIGH){} 
}

void loop() {
  byte i;
  
  waitForPress();
  playcomplete("DO.WAV");
  waitForPress();
  playcomplete("RE.WAV");
  waitForPress();
  playcomplete("MI.WAV");
  waitForPress();
  playcomplete("FA.WAV");
  waitForPress();
  playcomplete("SO.WAV");
  waitForPress();
  playcomplete("LA.WAV");
  waitForPress();
}

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”