playcomplete question
Moderators: adafruit_support_bill, adafruit

playcomplete question

by MikeT19278 on Mon Oct 21, 2013 3:24 pm

Hi,

I'm trying to program an arduino with a waveshield to play sounds in a random order. I've based my script off of the play6_HC script in the tutorial. I know the waveshield is operational as it plays the sounds from the card using the dap_hc script.

When I try to compile, I get an error at this line

void playcomplete(char *name) {

The error is "a function-definition is not allowed here before "{" token"

I've looked over the code and can't see any difference between this and the play6_HC code which compiles OK. Am I missing something.

Thanks.
MikeT19278
 
Posts: 11
Joined: Wed Sep 16, 2009 4:04 pm

Re: playcomplete question

by adafruit_support_bill on Mon Oct 21, 2013 3:59 pm

Check to make sure that all your brackets { } are balanced. If you post your code we may be able to spot the problem.
User avatar
adafruit_support_bill
 
Posts: 30794
Joined: Sat Feb 07, 2009 10:11 am

Re: playcomplete question

by MikeT19278 on Mon Oct 21, 2013 11:21 pm

Thanks for the suggestion about the brackets. I did find one orphaned "{" and I've now gone through and made sure they all match.

Now, however, I get a different error at the same line

playcomplete("courage.wav");

The error is "playcomplete' was not declared in this scope"

The code is pasted below. Basically, it's a sorting hat (from Harry Potter) plays two sets of sounds: an intro and a house name. There are several sets of random number that decide whether or not to play the intro, which intro file to play, and then which house name file to play.

Thanks for your help!

Code: Select all | TOGGLE FULL SIZE


// This is stuff for the wave shield

#include <FatReader.h>
#include <SdReader.h>
#include <avr/pgmspace.h>
#include "WaveUtil.h"
#include "WaveHC.h"


SdReader card;    // This object holds the information for the card
FatVolume vol;    // This holds the information for the partition on the card
FatReader root;   // This holds the information for the filesystem on the card
FatReader f;      // This holds the information for the file we're play

WaveHC wave;      // This is the only wave (audio) object, since we will only play one at a time

long rand1;      // variable to store random number to decide whether to speak the intro or not

long rand2;    //variable to store random number to decide which intro to speak

long rand3;   // variable to store random number to decide which house to speak
 
void setup()
{
 
  randomSeed(analogRead(0));   //uses noise input from analog pin 0 to generate random number seed

 
  // Set the output pins for the DAC control. This pins are defined in the library
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
 
  // pin13 LED
  pinMode(13, OUTPUT);
 
 

  // enable optimize read - some cards may timeout. Disable if you're having problems
  card.partialBlockRead(true);
 
// Now we will look for a FAT partition!
  uint8_t part;
  for (part = 0; part < 5; part++) {     // we have up to 5 slots to look in
    if (vol.init(card, part))
      break;                             // we found one, lets bail
  }
  if (part == 5) {                       // if we ended up not finding one  :(
    putstring_nl("No valid FAT partition!");
   // sdErrorCheck();      // Something went wrong, lets print out why
    while(1);                            // then 'halt' - do nothing!
  }
 
  // Lets tell the user about what we found
  putstring("Using partition ");
  Serial.print(part, DEC);
  putstring(", type is FAT");
  Serial.println(vol.fatType(),DEC);     // FAT16 or FAT32?
 
  // Try to open the root directory
  if (!root.openRoot(vol)) {
    putstring_nl("Can't open root dir!"); // Something went wrong,
    while(1);                             // then 'halt' - do nothing!
  }
 
  // Whew! We got past the tough parts.
  putstring_nl("Ready!");
}

void loop ()

{

rand1 = random(2);

if (rand1 > 0)

//this is the subroutine to play the intro sound. 

{

rand2 = random (9);

switch (rand2) {
    case 1:
      playcomplete("courage.wav");
      break;
    case 2:
      playcomplete("difficult.wav");
      break;
    case 3:
      playcomplete("I_know.wav");
      break;
    case 4:
      playcomplete("Ino_just.wav");
      break;
    case 5:
      playcomplete("itsallhe.wav");
      break;
    case 6:
      playcomplete("OK.wav");
break;
    case 7:
      playcomplete("right.wav");
      break;
    case 8:
      playcomplete("whereput.wav");
     
  }
}

delay (500);  //delay between intro and house

rand3 = random (6);  //subroutine to play house file.

switch (rand3) {
    case 1:
      playcomplete("griff1.wav");
      break;
     
    case 2:
      playcomplete("griff2.wav");
      break;
    case 3:
      playcomplete("huffp.wav");
      break;
    case 4:
      playcomplete("slythern.wav");
      break;
    case 5:
     playcomplete("huffp.wav");
}
// Plays a full file from beginning to end with no pause.
void playcomplete(char *name) {
// call our helper to find and play this name
playfile(name);
while (wave.isplaying) {
// do nothing while its playing
}
// now its done playing
}
 
void playfile(char *name) {
// see if the wave object is currently doing something
if (wave.isplaying) {// already playing something, so stop it!
wave.stop(); // stop it
}
// look in the root directory and open the file
if (!f.open(root, name)) {
putstring("Couldn't open file "); Serial.print(name); return;
}
// OK read the file and turn it into a wave object
if (!wave.create(f)) {
putstring_nl("Not a valid WAV"); return;
}
// ok time to play! start playback
wave.play();
}
}




MikeT19278
 
Posts: 11
Joined: Wed Sep 16, 2009 4:04 pm

Re: playcomplete question

by adafruit_support_bill on Tue Oct 22, 2013 6:28 am

It is not enough for the brackets to be balanced. They have to make sense too.
It looks like you just added a close bracket to the end of the file, but it was missing from the end of your loop() function. The result was that all your other functions such as playcomplete() were being defined as part of loop() instead of as separate functions.

It's all much clearer if you use a consistent indenting style to show the nesting level of your code blocks. I re-formatted the code below:

Code: Select all | TOGGLE FULL SIZE
// This is stuff for the wave shield

#include <FatReader.h>
#include <SdReader.h>
#include <avr/pgmspace.h>
#include "WaveUtil.h"
#include "WaveHC.h"


SdReader card;    // This object holds the information for the card
FatVolume vol;    // This holds the information for the partition on the card
FatReader root;   // This holds the information for the filesystem on the card
FatReader f;      // This holds the information for the file we're play

WaveHC wave;      // This is the only wave (audio) object, since we will only play one at a time

long rand1;      // variable to store random number to decide whether to speak the intro or not

long rand2;    //variable to store random number to decide which intro to speak

long rand3;   // variable to store random number to decide which house to speak

// Setup - executes once at startup
void setup()
{
   randomSeed(analogRead(0));   //uses noise input from analog pin 0 to generate random number seed

   // Set the output pins for the DAC control. This pins are defined in the library
   pinMode(2, OUTPUT);
   pinMode(3, OUTPUT);
   pinMode(4, OUTPUT);
   pinMode(5, OUTPUT);

   // pin13 LED
   pinMode(13, OUTPUT);
   
   // enable optimize read - some cards may timeout. Disable if you're having problems
   card.partialBlockRead(true);

   // Now we will look for a FAT partition!
   uint8_t part;
   for (part = 0; part < 5; part++)
   {     // we have up to 5 slots to look in
      if (vol.init(card, part))
         break;                             // we found one, lets bail
   }
   if (part == 5)
   {                       // if we ended up not finding one  :(
      putstring_nl("No valid FAT partition!");
      // sdErrorCheck();      // Something went wrong, lets print out why
      while(1);                            // then 'halt' - do nothing!
   }

   // Lets tell the user about what we found
   putstring("Using partition ");
   Serial.print(part, DEC);
   putstring(", type is FAT");
   Serial.println(vol.fatType(),DEC);     // FAT16 or FAT32?

   // Try to open the root directory
   if (!root.openRoot(vol))
   {
      putstring_nl("Can't open root dir!"); // Something went wrong,
      while(1);                             // then 'halt' - do nothing!
   }

   // Whew! We got past the tough parts.
   putstring_nl("Ready!");
}


// Main loop - executes over & over after setup
void loop ()
{
   rand1 = random(2);

   if (rand1 > 0)   
   {
      rand2 = random (9);

      switch (rand2) {
      case 1:
         playcomplete("courage.wav");
         break;
      case 2:
         playcomplete("difficult.wav");
         break;
      case 3:
         playcomplete("I_know.wav");
         break;
      case 4:
         playcomplete("Ino_just.wav");
         break;
      case 5:
         playcomplete("itsallhe.wav");
         break;
      case 6:
         playcomplete("OK.wav");
         break;
      case 7:
         playcomplete("right.wav");
         break;
      case 8:
         playcomplete("whereput.wav");

      }
   }

   delay (500);  //delay between intro and house

   rand3 = random (6);  //subroutine to play house file.

   switch (rand3)
   {
   case 1:
      playcomplete("griff1.wav");
      break;

   case 2:
      playcomplete("griff2.wav");
      break;
   case 3:
      playcomplete("huffp.wav");
      break;
   case 4:
      playcomplete("slythern.wav");
      break;
   case 5:
      playcomplete("huffp.wav");
   }
}


// Plays a full file from beginning to end with no pause.
void playcomplete(char *name)
{
   // call our helper to find and play this name
   playfile(name);
   while (wave.isplaying)
   {
      // do nothing while its playing
   }
   // now its done playing
}

// Start playing a file.
void playfile(char *name)
{
   // see if the wave object is currently doing something
   if (wave.isplaying)
   {// already playing something, so stop it!
      wave.stop(); // stop it
   }
   // look in the root directory and open the file
   if (!f.open(root, name))
   {
      putstring("Couldn't open file "); Serial.print(name); return;
   }
   // OK read the file and turn it into a wave object
   if (!wave.create(f))
   {
      putstring_nl("Not a valid WAV"); return;
   }
   // ok time to play! start playback
   wave.play();
}
User avatar
adafruit_support_bill
 
Posts: 30794
Joined: Sat Feb 07, 2009 10:11 am

Re: playcomplete question

by MikeT19278 on Tue Oct 29, 2013 2:52 pm

OK, so I have the logic working correctly now, but there still seems to be a problem reading the wav files. (They read correctly using the dap_hc sketch.)

The code is pasted below. I am getting the "couldn't open file" message (and no audio output) in line 205. My files are all in the root level of the SD card (no folders), so do I have something wrong with the file names? They're all caps in both the code and on the card.

Thanks so much for your help!

Code: Select all | TOGGLE FULL SIZE

// This is stuff for the wave shield

#include <FatReader.h>
#include <SdReader.h>
#include <avr/pgmspace.h>
#include "WaveUtil.h"
#include "WaveHC.h"


SdReader card;    // This object holds the information for the card
FatVolume vol;    // This holds the information for the partition on the card
FatReader root;   // This holds the information for the filesystem on the card
FatReader f;      // This holds the information for the file we're play

WaveHC wave;      // This is the only wave (audio) object, since we will only play one at a time

long rand1;      // variable to store random number to decide whether to speak the intro or not

long rand2;    //variable to store random number to decide which intro to speak

long rand3;   // variable to store random number to decide which house to speak

// this handy function will return the number of bytes currently free in RAM, great for debugging!   
int freeRam(void)
{
  extern int  __bss_end;
  extern int  *__brkval;
  int free_memory;
  if((int)__brkval == 0) {
    free_memory = ((int)&free_memory) - ((int)&__bss_end);
  }
  else {
    free_memory = ((int)&free_memory) - ((int)__brkval);
  }
  return free_memory;
}

void sdErrorCheck(void)
{
  if (!card.errorCode()) return;
  putstring("\n\rSD I/O error: ");
  Serial.print(card.errorCode(), HEX);
  putstring(", ");
  Serial.println(card.errorData(), HEX);
  while(1);
}



// Setup - executes once at startup
void setup()
{
   randomSeed(analogRead(0));   //uses noise input from analog pin 0 to generate random number seed

// set up serial port
  Serial.begin(9600);
  putstring_nl("WaveHC with 6 buttons");
 
   putstring("Free RAM: ");       // This can help with debugging, running out of RAM is bad
  Serial.println(freeRam());      // if this is under 150 bytes it may spell trouble!


   // Set the output pins for the DAC control. This pins are defined in the library
   pinMode(2, OUTPUT);
   pinMode(3, OUTPUT);
   pinMode(4, OUTPUT);
   pinMode(5, OUTPUT);

   // pin13 LED
   pinMode(13, OUTPUT);

//  if (!card.init(true)) { //play with 4 MHz spi if 8MHz isn't working for you
  if (!card.init()) {         //play with 8 MHz spi (default faster!) 
    putstring_nl("Card init. failed!");  // Something went wrong, lets print out why
    sdErrorCheck();
    while(1);                            // then 'halt' - do nothing!
  }

   
   // enable optimize read - some cards may timeout. Disable if you're having problems
   card.partialBlockRead(true);

   // Now we will look for a FAT partition!
   uint8_t part;
   for (part = 0; part < 5; part++)
   {     // we have up to 5 slots to look in
      if (vol.init(card, part))
         break;                             // we found one, lets bail
   }
   if (part == 5)
   {                       // if we ended up not finding one  :(
      putstring_nl("No valid FAT partition!");
      // sdErrorCheck();      // Something went wrong, lets print out why
      while(1);                            // then 'halt' - do nothing!
   }

   // Lets tell the user about what we found
   putstring("Using partition ");
   Serial.print(part, DEC);
   putstring(", type is FAT");
   Serial.println(vol.fatType(),DEC);     // FAT16 or FAT32?

   // Try to open the root directory
   if (!root.openRoot(vol))
   {
      putstring_nl("Can't open root dir!"); // Something went wrong,
      while(1);                             // then 'halt' - do nothing!
   }

   // Whew! We got past the tough parts.
   putstring_nl("Ready!");
}


// Main loop - executes over & over after setup
void loop ()
{
   rand1 = random(2);

putstring ("inside the loop");

   if (rand1 > 0)   
   {
      rand2 = random (9);

      switch (rand2) {
      case 1:
         playcomplete("COURAGE.WAV");
         break;
      case 2:
         playcomplete("DIFFICULT.WAV");
         break;
      case 3:
         playcomplete("I_KNOW.WAV");
         break;
      case 4:
         playcomplete("INO_JUST.WAV");
         break;
      case 5:
         playcomplete("ITSALLHER.WAV");
         break;
      case 6:
         playcomplete("OK.WAV");
         break;
      case 7:
         playcomplete("RIGHT.WAV");
         break;
      case 8:
         playcomplete("WHEREPUT.WAV");

      }
   }

   delay (500);  //delay between intro and house

   rand3 = random (6);  //subroutine to play house file.

   switch (rand3)
   {
   case 1:
      playcomplete("GRIFF1.WAV");
      break;

   case 2:
      playcomplete("GRIFF2.WAV");
      break;
   case 3:
      playcomplete("HUFFP.WAV");
      break;
   case 4:
      playcomplete("SLYTHERN.WAV");
      break;
   case 5:
      playcomplete("HUFFP.WAV");
   }
}


// Plays a full file from beginning to end with no pause.
void playcomplete(char *name)
{
   // call our helper to find and play this name
   playfile(name);
   while (wave.isplaying)
   {
      // do nothing while its playing
   }
   // now its done playing
}

// Start playing a file.
void playfile(char *name)
{
   // see if the wave object is currently doing something
   if (wave.isplaying)
   {// already playing something, so stop it!
      wave.stop(); // stop it
   }
   // look in the root directory and open the file
   if (!f.open(root, name))
   {
      putstring("Couldn't open file "); Serial.print(name); return;
   }
   // OK read the file and turn it into a wave object
   if (!wave.create(f))
   {
      putstring_nl("Not a valid WAV"); return;
   }
   // ok time to play! start playback
   wave.play();
}

MikeT19278
 
Posts: 11
Joined: Wed Sep 16, 2009 4:04 pm

Re: playcomplete question

by adafruit_support_bill on Tue Oct 29, 2013 4:52 pm

Looks like some of your files have 9 character (plus extension) file names. WaveHC only supports old-style FAT 8.3 file names.
User avatar
adafruit_support_bill
 
Posts: 30794
Joined: Sat Feb 07, 2009 10:11 am

Re: playcomplete question

by MikeT19278 on Tue Oct 29, 2013 11:51 pm

*facepalm* You'd think I'd be able to count to eight by now.

File names corrected, but it still doesn't read the files. That is, it's going through the logic of the sketch correctly, but when it gets to read the file, I still get the "couldn't open file" message from line 205.

Any help would be appreciated!

Code: Select all | TOGGLE FULL SIZE
// This is stuff for the wave shield

#include <FatReader.h>
#include <SdReader.h>
#include <avr/pgmspace.h>
#include "WaveUtil.h"
#include "WaveHC.h"


SdReader card;    // This object holds the information for the card
FatVolume vol;    // This holds the information for the partition on the card
FatReader root;   // This holds the information for the filesystem on the card
FatReader f;      // This holds the information for the file we're play

WaveHC wave;      // This is the only wave (audio) object, since we will only play one at a time

long rand1;      // variable to store random number to decide whether to speak the intro or not

long rand2;    //variable to store random number to decide which intro to speak

long rand3;   // variable to store random number to decide which house to speak

// this handy function will return the number of bytes currently free in RAM, great for debugging!   
int freeRam(void)
{
  extern int  __bss_end;
  extern int  *__brkval;
  int free_memory;
  if((int)__brkval == 0) {
    free_memory = ((int)&free_memory) - ((int)&__bss_end);
  }
  else {
    free_memory = ((int)&free_memory) - ((int)__brkval);
  }
  return free_memory;
}

void sdErrorCheck(void)
{
  if (!card.errorCode()) return;
  putstring("\n\rSD I/O error: ");
  Serial.print(card.errorCode(), HEX);
  putstring(", ");
  Serial.println(card.errorData(), HEX);
  while(1);
}



// Setup - executes once at startup
void setup()
{
   randomSeed(analogRead(0));   //uses noise input from analog pin 0 to generate random number seed

// set up serial port
  Serial.begin(9600);
  putstring_nl("WaveHC with 6 buttons");
 
   putstring("Free RAM: ");       // This can help with debugging, running out of RAM is bad
  Serial.println(freeRam());      // if this is under 150 bytes it may spell trouble!


   // Set the output pins for the DAC control. This pins are defined in the library
   pinMode(2, OUTPUT);
   pinMode(3, OUTPUT);
   pinMode(4, OUTPUT);
   pinMode(5, OUTPUT);

   // pin13 LED
   pinMode(13, OUTPUT);

//  if (!card.init(true)) { //play with 4 MHz spi if 8MHz isn't working for you
  if (!card.init()) {         //play with 8 MHz spi (default faster!) 
    putstring_nl("Card init. failed!");  // Something went wrong, lets print out why
    sdErrorCheck();
    while(1);                            // then 'halt' - do nothing!
  }

   
   // enable optimize read - some cards may timeout. Disable if you're having problems
   card.partialBlockRead(true);

   // Now we will look for a FAT partition!
   uint8_t part;
   for (part = 0; part < 5; part++)
   {     // we have up to 5 slots to look in
      if (vol.init(card, part))
         break;                             // we found one, lets bail
   }
   if (part == 5)
   {                       // if we ended up not finding one  :(
      putstring_nl("No valid FAT partition!");
      // sdErrorCheck();      // Something went wrong, lets print out why
      while(1);                            // then 'halt' - do nothing!
   }

   // Lets tell the user about what we found
   putstring("Using partition ");
   Serial.print(part, DEC);
   putstring(", type is FAT");
   Serial.println(vol.fatType(),DEC);     // FAT16 or FAT32?

   // Try to open the root directory
   if (!root.openRoot(vol))
   {
      putstring_nl("Can't open root dir!"); // Something went wrong,
      while(1);                             // then 'halt' - do nothing!
   }

   // Whew! We got past the tough parts.
   putstring_nl("Ready!");
}


// Main loop - executes over & over after setup
void loop ()
{
   rand1 = random(2);

putstring ("inside the loop");

   if (rand1 > 0)   
   {
      rand2 = random (9);

      switch (rand2) {
      case 1:
         playcomplete("COURAGE.WAV");
         break;
      case 2:
         playcomplete("DIFFICUL.WAV");
         break;
      case 3:
         playcomplete("I_KNOW.WAV");
         break;
      case 4:
         playcomplete("INO_JUST.WAV");
         break;
      case 5:
         playcomplete("ITSALLHE.WAV");
         break;
      case 6:
         playcomplete("OK.WAV");
         break;
      case 7:
         playcomplete("RIGHT.WAV");
         break;
      case 8:
         playcomplete("WHEREPUT.WAV");

      }
   }

   delay (500);  //delay between intro and house

   rand3 = random (6);  //subroutine to play house file.

   switch (rand3)
   {
   case 1:
      playcomplete("GRIFF1.WAV");
      break;

   case 2:
      playcomplete("GRIFF2.WAV");
      break;
   case 3:
      playcomplete("HUFFP.WAV");
      break;
   case 4:
      playcomplete("SLYTHERN.WAV");
      break;
   case 5:
      playcomplete("HUFFP.WAV");
   }
}


// Plays a full file from beginning to end with no pause.
void playcomplete(char *name)
{
   // call our helper to find and play this name
   playfile(name);
   while (wave.isplaying)
   {
      // do nothing while its playing
   }
   // now its done playing
}

// Start playing a file.
void playfile(char *name)
{
   // see if the wave object is currently doing something
   if (wave.isplaying)
   {// already playing something, so stop it!
      wave.stop(); // stop it
   }
   // look in the root directory and open the file
   if (!f.open(root, name))
   {
      putstring("Couldn't open file "); Serial.print(name); return;
   }
   // OK read the file and turn it into a wave object
   if (!wave.create(f))
   {
      putstring_nl("Not a valid WAV"); return;
   }
   // ok time to play! start playback
   wave.play();
}

MikeT19278
 
Posts: 11
Joined: Wed Sep 16, 2009 4:04 pm

Re: playcomplete question

by adafruit_support_bill on Wed Oct 30, 2013 6:06 am

*facepalm* You'd think I'd be able to count to eight by now.

I grew up programming in octal. I never got to 8. :wink:

Nothing obvious looks wrong there. Does it have trouble with every file, or just some of them? Does the dapHC sketch work?
User avatar
adafruit_support_bill
 
Posts: 30794
Joined: Sat Feb 07, 2009 10:11 am

Re: playcomplete question

by MikeT19278 on Wed Oct 30, 2013 9:43 am

It has trouble playing every file.

The dapHC sketch works fine.
MikeT19278
 
Posts: 11
Joined: Wed Sep 16, 2009 4:04 pm

Re: playcomplete question

by adafruit_support_bill on Wed Oct 30, 2013 10:07 am

Could be a memory problem. http://learn.adafruit.com/memories-of-a ... o-memories
Try applying the "F" macro to some of those literal strings. That will free up a bunch of SRAM: http://learn.adafruit.com/memories-of-a ... izing-sram
User avatar
adafruit_support_bill
 
Posts: 30794
Joined: Sat Feb 07, 2009 10:11 am

Re: playcomplete question

by MikeT19278 on Wed Oct 30, 2013 1:49 pm

OK, applied the F macro to all the strings, and changed the "putstring"s to "Serial.print"s while I was at it. No difference in performance.

I also commented out the "card.partialBlockRead(true)" command as it mentions to do that if you're having problems. No difference.

I then stripped out all the stuff inside the loop and had it play only one wave file, and it still can't do that.

I'm at a bit of a loss at this point. Is it possible that the card is formatted weird? The dapHC sketch runs fine, but that sketch purposely looks for different directories. whereas this assumes the files are in the root level (which I think they are).

Thanks for your help.
MikeT19278
 
Posts: 11
Joined: Wed Sep 16, 2009 4:04 pm

Re: playcomplete question

by adafruit_support_bill on Wed Oct 30, 2013 1:56 pm

Is it possible that the card is formatted weird? The dapHC sketch runs fine, but that sketch purposely looks for different directories. whereas this assumes the files are in the root level (which I think they are).

Look at the serial output of dapHC. If I recall correctly, it tells you whenever it opens a directory. I do recall once someone posted a similar problem and it turned out to be some weird formatting issue.
User avatar
adafruit_support_bill
 
Posts: 30794
Joined: Sat Feb 07, 2009 10:11 am

Re: playcomplete question

by MikeT19278 on Wed Oct 30, 2013 4:32 pm

Looked at the serial output from dapHC and all the files seem to be on the root level. When I moved one into a folder, it mentioned that in the output.

Reformatted the card anyways, and it made no difference.

I loaded the Play6 example, and it also gives the same "couldn't open file" error (button press simulated by shorting one of the pins to ground momentarily). So this tells me that it's not my hacking of the code, and something else.
MikeT19278
 
Posts: 11
Joined: Wed Sep 16, 2009 4:04 pm

Re: playcomplete question

by adafruit_support_rick on Thu Oct 31, 2013 10:02 am

Try running the listfiles example from the SD library. That should tell you the exact structure of your SD card and all of the filenames. Make sure the file names match the ones in your code.

adafruit_support_rick
 
Posts: 12827
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: playcomplete question

by MikeT19278 on Thu Oct 31, 2013 1:27 pm

Success!

OK when I ran the listfiles sketch, it printed out the files, but with the file names changed into the 8.3 format with the tildes and such, i.e., the file "COURAGE.WAV" listed out as COURAG~1.WAV. So, I changed all the file names in the sketch to match those listed out and it works.

So, even though I believed "COURAGE.WAV" was a valid file name since it fit within the 8.3 parameter, obviously every file name has to be exactly 8 characters long with .WAV appended. This is strange because the file names in the Play6 sketch do not follow this format (i.e., SOUND1.WAV).

Any opinion on why the discrepency?

In any case, thanks so much for all your help!
MikeT19278
 
Posts: 11
Joined: Wed Sep 16, 2009 4:04 pm