Trouble extracting data using DMIC

Hi there!

I am using the DMIC sample on a nrf5340dk. I have got it working, and now I want to develop it further. I want to record some sound and then transfer it to my PC. I have a lot of questions that I struggle with finding the answers to.

Now I understand that the data stored should already be stored as PCM data. So I can easily convert them to WAV files with a script on my PC. Is this correct?

When I record now I can leave it one for multiple seconds, but the data collected only corresponds to a few milliseconds. I suspect this is due to a lot of time being used logging to the console. The way I do it now, is that I log the collected data to the console, and then extract it onto the PC from there. However I can imagine this is quite slow. I was thinking of printing it out after the recording is done instead. But I struggle with understanding how the memory allocation in this sample works. I use:

void *buffer;

But this buffer get owerwritten with new data. How do I go about not overwriting the data and retrieving it later? (The recording does not need to be longer than a few seconds, maybe even shorter)

I also struggle with understanding the part the memory slab plays in the program. Defined as:

K_MEM_SLAB_DEFINE_STATIC(mem_slab, MAX_BLOCK_SIZE, BLOCK_COUNT, 4);
Related