Hello, I was thinking of a use case of performing an audio classification model on the TinyML board, and then depending on that inference, playing an audio file (from the SD card) on an 8 Ohm speaker. Is this possible on the TinyML board? I was planning on using Edge Impulse to create and deploy the model to an Arduino sketch, and I have compiled the sample Edge Impulse code/sketch. However, I’ve had trouble integrating a library to play audio (I’ve had success with TRMpcm with an Arduino uno). The audio libraries I’ve tried also bring up SD code issues as well.
Not sure if this is even possible with the TinyML board. Figured I would reach out to the forum before I spend too much time.
Are there any sample sketches anywhere of using the SD card? I’ve only seen the low power example sketch on this forum.
This is a great idea. As you are aware that TinyML is based on Arduino MKR Zero. However, small subset of pins are brought out. Please review if these pins can generate audio signal or not. The data can be saved easily on uSD card, the same way as it can saved on Arduino MKR Zero board using SDFat library. I will reachout to you and give you some sample code.
Thanks. I’m pretty sure I just need a DAC pin (A0) on the MKR Zero. Other challenge is finding an audio library that is compatible. Thanks again. Looking forward to the sample sketches.
This is using the same libraries which is shown in the low power repo by R. D. Poor.
The sketch creates a file, writes data and then reads it and displays it.
Thank you. Atul sent me some code as well, and I was able to get audio outputted on pin 5 to a speaker. Below is the code using the AudioZero library. However, I’m now trying to run it in the Edge Impulse firmware, and it hangs when a keyword is detected. Here is the code:
The model that I created works pretty well, and the keyword spotting is solid. Is there a mutex or a block on the SD card while inference is running? Is it a timing thing in syntiant_loop()? Any help would be appreciated. I feel like I am almost there!