PDM library setGain doesn't work

PDM library setGain doesn’t work

Project ID:
PDM related projects.

Context/Use case:

I found nothing changes as I change the PDM gain from PDM.setGain(127) to PDM.setGain(255). According to Nano_BLE_MCU-nRF52840_PS_v1.1.pdf, it seems that GAINL and GAINR can only be set from 0x00 to 0x50. I am wondering why the PDM Library Doc tells that parameters of setGain() function can be 0-255.

Thank you all.

Hi @chihshan,

In my experience, adjusting the gain does not affect keyword spotting much, as what really matters is the signal-to-noise ratio (which gain does not change all that much).

That being said, if you are finding that the PDM gain setting is not affecting the actual gain of the captured signal, then that sounds like a problem with the underlying Arduino library. I recommend creating a post on the Arduino forums for that: https://forum.arduino.cc/

1 Like

Ardy’s PDM.h is hardware dependent:

  //PORTENTA_H7 min -12 max 51
  //NANO 33 BLE SENSe min 0 max 80
  //NICLA_VISION min 0 max 8
  void setGain(int gain);

@MMarcial Thank you for your reply! Now I get it!

1 Like

@ShawnHymel Thank you for your reply!

1 Like