I found the ArduinoSound library for samd21 chips, but it seems to only include functionality for reading from an SD card. I found this tutorial which also assumes an SD card. How would I play a .wav file from my QT Py to my breakout dac/amp from the QT Py's flash memory? This can be with or without the ArduinoSound library. The flash is GD25Q16CTIGR in case that's relevant.
Does your qtpy have the extra flash chip installed? If not, it doesn’t have very much flash (how big is your .wav, and how are you loading it into flash?)
Yes, I soldered the extra flash. The WAV files are quite small, mostly chimes and alert sounds. I have 2 MB of flash and the four files are about 350 KB total. I plan on loading the files via usb-c and as an eventual stretch goal through UART or CAN.
Bump! I'm still trying to figure out how to use a WAV file. Someone else suggested using a C header with just the PCM data, but I can't do that manually since I need this device to be accessible via usb to a computer using a file system like FAT, e.g.
For that reason, I'm thinking of using SPI flash instead of the soldered QT Py flash since the former is more likely supported by a library.
First, you need a library that will treat the added flash chip as a filesystem. I believe that Adafruit provides such a thing.
Then you'll need to make sure that the ArduinoSound library is compatible with that filesystem code, which perhaps will involve modifying the SDWaveFile class.
Finally, you'll need to have your sketch have some mechanism for loading files onto the flash chip. (Presumably, the reason that ArduinoSound assumes an SD card is that that way you can put files onto the card using a PC and standard SDcard reader/writer things.)