Audio Library and SD Card Remove during Play

otti123

Member
Dear Paul,

we are using Teensy 3.1 together with Audio board in a business project for playing WAV files from SD Card.
Now i have the problem that our customer wants to have a solution when SD Card is removed during playback of a WAV file.
If duing so, the output sound is a terrible noise.

Question: In which place of the audio library i need to check for SD Card removed and if it is possible to detect that situation. SD Card is connect with SPI interface. We do not use the Micro SD card socket on the audio board. We have connected a normal size SD card adapter through SPI.

Best Regards

Ottmar
 
How about putting a door with a sensor over the SD card? When the door opens, stop the WAV from playing. When the door closes, resume playing.
 
Yes, things could be and should be much better. Someday they probably even will be....

The audio library should at least mute the player object's output if the SD library gives errors. Currently, it behaves badly. I filed a bug on the audio library github, so I won't forget to work on this later. (where "later" probably means sometime in 2016, to be realistic)

https://github.com/PaulStoffregen/Audio/issues/122

The SD library could be a *lot* better. Earlier this year I started a complete redesign of the SD library. It's still very much a work-in-progress, and detection of card removal and replacement is on my long-term goals list, but still a very long way off.

I wish I could improve these and so many other things instantly, but it does take time. Eventually I will.
 
Thanks a lot Paul. I understand that this issue is a long term goal. Can you give me some advices where i can look in the library files so that i have a chance to receive some error code during playback of WAV files ? I can debug step by step but this is also a long and time consuming task. I never had a look into these library files and so it will need a long time.

Best Regards, Ottmar
 
fwiw / IIRC, this hack of the audio lib adds "hot swapping" (well, the comments say so). Apparently it's broken now, but I don't know which version is broken or what exactly is broken, I never used it.
 
says 256 normal and only silences on extra read? But about a short read<256? Does that mean it was truncated unexpectedly as well.

Code:
111 // Normal read = 256 bytes, if not normal, return  
112 // ADD THIS SECTION TO ENABLE HOT SWAPPING  
113 if (n > 256) {
 
Back
Top