Very Low Audio intensity in PSOC6

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
GiVa_4744441
Level 1
Level 1

I have a CY8CPROTO-062-4343W. I am trying to record audio by modifying PCM/PDM sample application in ModusToolbox. I use the following settings in cyhal_pdm_pcm_cfg_t:

  • PCM sampling rate: 16 kHz
  • mode LEFT channel
  • LEFT GAIN 12
  • RIGHT GAIN 12

When I play the audio the gain is surprisingly low. The gain settings doesn't have much effect on the intensity. I tried using the function cyhal_pdm_pcm_set_gain without any success. The mic seems to have a sensitivity of -26 dB. What shall I do to get the intensity high? Is there any other settings to change the gain of the audio collected using pcm hal?

0 Likes
1 Solution
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

GiVa,

You are correct the standard gain in the USB_Audio_Recorder project is fairly low.

There are a few ways to improve the sensitivity.  Some better than others.

Option #1:

In the file audio_in.c change:

/* HAL Config */

const cyhal_pdm_pcm_cfg_t pdm_pcm_cfg =

{

    .sample_rate     = AUDIO_SAMPLING_RATE_48KHZ,

    .decimation_rate = DECIMATION_RATE,

    .mode            = CYHAL_PDM_PCM_MODE_STEREO,

    .word_length     = 16,  /* bits */

    .left_gain       = 0,   /* dB */

    .right_gain      = 0,   /* dB */

};

to:

/* HAL Config */

const cyhal_pdm_pcm_cfg_t pdm_pcm_cfg =

{

    .sample_rate     = AUDIO_SAMPLING_RATE_48KHZ,

    .decimation_rate = DECIMATION_RATE,

    .mode            = CYHAL_PDM_PCM_MODE_STEREO,

    .word_length     = 16,  /* bits */

    .left_gain       = CY_PDM_PCM_GAIN_10_5_DB ,   /* dB */

    .right_gain      = CY_PDM_PCM_GAIN_10_5_DB ,   /* dB */

};

This maximizes the input gain to the max allowed.

Your setting of 12 amplified the gain to +6dB only.

 CY_PDM_PCM_GAIN_6_DB       = 12U,        /**< +6 dB (amplification). */

Option #2:

For each byte received from the PDM to PCM conversion, shift left by:

  • 1 to increase the volume by 2x.
  • 2 to increase the volume by 4x.
  • 3 to increase the volume by 8x.
  • ... I think you can see the pattern here.

There are two major downsides to this method.

You may be have a limited output data rate.  This is because the CPU must process the incoming data before being sent out the USB.

Amplifying the signal across the board also amplifies the noise.

Maybe someone with more PDM experience than me might come up with a third option.

Len

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

0 Likes
4 Replies
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

giva,

Hi.  If you haven't done so already, I recommend downloading the PDM_PCM_Audio example.  I've tried it.  It has acceptable microphone sensitivity for me.  This would be a great starting point for your code.

pastedImage_0.png

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

Thank you for the quick response. I am using the same pdm pcm audio sample application. The audio was very feeble for me. How much was your audio intensity? I was not able to hear it properly. My speech audio RMS is -40 dB in audacity and the max amplitude is less than 0.1 on a linear scale, which is very feeble if I listen on the laptop.

0 Likes

Please try to config high pass filter gain from default 0 to 8, see if it helps. Current cyhal_pdm_pcm_init() API miss to config this parameter, you may call Cy_PDM_PCM_Init() API to initialize the high pass filter gain.

0 Likes
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

GiVa,

You are correct the standard gain in the USB_Audio_Recorder project is fairly low.

There are a few ways to improve the sensitivity.  Some better than others.

Option #1:

In the file audio_in.c change:

/* HAL Config */

const cyhal_pdm_pcm_cfg_t pdm_pcm_cfg =

{

    .sample_rate     = AUDIO_SAMPLING_RATE_48KHZ,

    .decimation_rate = DECIMATION_RATE,

    .mode            = CYHAL_PDM_PCM_MODE_STEREO,

    .word_length     = 16,  /* bits */

    .left_gain       = 0,   /* dB */

    .right_gain      = 0,   /* dB */

};

to:

/* HAL Config */

const cyhal_pdm_pcm_cfg_t pdm_pcm_cfg =

{

    .sample_rate     = AUDIO_SAMPLING_RATE_48KHZ,

    .decimation_rate = DECIMATION_RATE,

    .mode            = CYHAL_PDM_PCM_MODE_STEREO,

    .word_length     = 16,  /* bits */

    .left_gain       = CY_PDM_PCM_GAIN_10_5_DB ,   /* dB */

    .right_gain      = CY_PDM_PCM_GAIN_10_5_DB ,   /* dB */

};

This maximizes the input gain to the max allowed.

Your setting of 12 amplified the gain to +6dB only.

 CY_PDM_PCM_GAIN_6_DB       = 12U,        /**< +6 dB (amplification). */

Option #2:

For each byte received from the PDM to PCM conversion, shift left by:

  • 1 to increase the volume by 2x.
  • 2 to increase the volume by 4x.
  • 3 to increase the volume by 8x.
  • ... I think you can see the pattern here.

There are two major downsides to this method.

You may be have a limited output data rate.  This is because the CPU must process the incoming data before being sent out the USB.

Amplifying the signal across the board also amplifies the noise.

Maybe someone with more PDM experience than me might come up with a third option.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes