1
$\begingroup$

I am new to MEMS digital microphone world. Currently, we are using built in PDM to PCM converter available in microcontroller.

The problem that is troubling me is how to choose the PCM buffer size, for the below configuration. Once we get the PCM data, I would like to store it into an output file using some terminal program and then use audacity to plot it to compare with input signal. Input signal I am using for testing purpose is 1Khz sine wave.

  • Clock to Microphone = 3MHz.
  • PDM to PCM data = 48kHz @ 24 bits.
  • PDM Data sampling = 48 kHz.

Current selection of buffer size = 48000/ 32bits = 1500 samples. Since Sampling rate is 48Khz and 32 bits since the output of PDM to PCM module provides 24bits.

Please let me know if my assumption is correct.

$\endgroup$
1
  • $\begingroup$ I am not sure there is any "hard" constraint on the buffer you "have" to use. Apart from technical details (on latency and efficiency) you could (in theory) get one sample and save it as it is. This would constitute a 1 sample buffer but still, as long as you emplace the samples one after the other in the correct order you would end up with the time series representation of your signal. Or, I may be missing something here... $\endgroup$
    – ZaellixA
    Commented Jun 2, 2023 at 10:10

1 Answer 1

2
$\begingroup$

For this type of application a fairly wide range of buffer sizes should work fine, although the exact details depend on your specific hardware and operating system (if any). 1500 seems like a very reasonable choice, although personally I would go with 1024, 1536 or 2048 (more powers of two in there).

A few things to consider

  1. If the buffer size is too small, you have two many calls to "write()" which creates a lot of overhead.
  2. If the buffer size is too large, you create a lot of latency, the "write()" call may take too long or you will simply run out of memory.
  3. It's most efficient if the buffer size is matched (equal, integer divider, integer multiplier) to the storage media's segment size.

Your PDM to PCM converter uses produces 24-bit which isn't a standard word size for most microprocessors. Chances are you can truncate it down to 16-bit without loss of information since the self noise of the microphone and/or the acoustic background noise will be higher than 16-bit quantization noise.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.