WaveHC: Filenames from SD in array

How many files are on the SD card? What are their names?

  allFilenames = (char**) malloc(fileCount * sizeof(char*));

What is the type for allFilenames?

        actFilename[i] = (char)dirBuf.name[i];

Why is it necessary to cast a char to a char?

        actFilename[i+1] = 0;

What is in actFilename after this?

        for(int j=0;j<strlen(actFilename);j++)
          Serial.print(actFilename[j]);

Have you got something against printing a string correctly?

Serial.print(actFilename);
  for(int i=0;i < fileCount;i++) {

Be nice to know what fileCount contains.

The data printed after the Filenames: line matches the crap printed before the Filenames: line, as far as I can see, except that it would appear that fileCount is hosed (perhaps because you've written beyond the end of an array.

Let's make this simpler. Do NOT try to strip off the .wav from the end of the name. Do NOT implement your own copy method.

char theName[16];
strcpy(theName, entry.name);
Serial.print("theName: [");
Serial.print(theName);
Serial.println("]");

allNames[theCount++] = strdup(theName);

// After the loop, print all the names.