I have been trying to record wav file on arduino mkr zero(SAMD21) for quiet some time now with analog mems mic, have been successful doing that but recording is not stable because of slow adc sampling. I have tried polling , interrupt(dual-buffer) and event system technique for fast adc sampling but i don't know each of them gives me inaccurate results. Attached code is for recording 16bit,48khz wav file for 10sec but file it only creates 7-8 sec wav file.
but recording is not stable because of slow adc sampling.
You sure of that. I would say it is the writing of large buffers that is causing you to miss interrupts. Have you tried simply holding the SD card file open and writing bytes to that as you get them?