Dictaphone project - MKRZero hangs indefinitely

Hi @lehippie, not sure if you've solved problem, but thought I'd share my experience anyway.

I've found that if the program, for any reason, stops reading the I2S buffer, then the whole I2s library stops.

I was running several other tasks in my main loop and found that if I didn't call i2s.read() fast enough then the i2s stopped.

This is probably not the case in your first example, however you're not calling I2S.available to check before reading data from I2S, which might be a problem.

I did a little digging, and found that the I2s uses DMA transfer with double buffer, so when data is available, it's actually a whole buffer's worth, not discrete samples direct from the I2S stream. You have to read the whole buffer before the DMA transfer finishes and switches back to the buffer you're reading from. If that makes sense.

Good luck