PDA

View Full Version : WAV File Names?



jkoffman
06-29-2016, 04:39 PM
Hi all,

I'm playing around with a Teensy on the Audio board. I downloaded the SDTEST1.WAV file and it plays just fine. When I substitute my own file (a sad trombone noise) I hear nothing. I am still seeing the "Start Playing" on the serial monitor, but it looks like it's repeating so fast that there's no way the library is playing the file.

Further investigation has shown that apparently something doesn't like the file names. It appears that if the file name starts with a single number, we're good (1Trombone.wav). If there are two or more numbers, it fails (01Trombone.wav). If there is a special character along with a single number, it also fails (1_Trombone.wav).

I'm not entirely sure what causes this. I'm starting to investigate on my own, but if anyone has any experience with this I'd love to know if you managed to get around this.

What I'd like to do eventually is have the Teensy have a number of triggers, and be able to put a file on the SD card prefaced by the number of the trigger I want to trigger it. So 01_Trombone.wav would play when trigger 1 is tripped.

Thank you!

Josh

el_supremo
06-29-2016, 05:11 PM
I think the SD library restricts filenames to be 8.3 format. But if that's so, I don't know how you got 1Trombone.wav to work.
Try shorter names such as 1_Trmbon.wav

Pete

jkoffman
06-29-2016, 05:16 PM
Hi Pete,

Aha, I believe you are correct. I just tried 001_TRO.WAV and it worked!

Now to figure out how I can use wildcards...

Thank you!

Josh

PaulStoffregen
06-30-2016, 04:32 PM
Now to figure out how I can use wildcards...


Look at File > Examples > SD > listfiles for an example that reads all the file names. There isn't any convenient wildcard support in the library, but you could build something that finds the files you like by going through that list and picking out the names which match.