MIC (AI channel) Crosstalk
Q1: Connect microphone to MIC0 and run the test program. Why is the audio of Mic0 on channel0/1?
Open the recorded wav file with Adobe Audition and found that channel 0 has clipping distortion and the amplitude exceeds 0db. It means that the input amplitude has exceeded the ADC's maximum amplitude (3.3V). There are two gains in the AI API that can be adjusted. Too much analog gain will cause clipping distortion:
MI_S32 MI_AI_SetChnParam(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_AI_ChnParam_t *pstChnParam); typedef struct MI_AI_ChnParam_s { MI_AI_ChnGainConfig_t stChnGain; MI_U32 u32Reserved; } MI_AI_ChnParam_t; typedef struct MI_AI_ChnGainConfig_s { MI_BOOL bEnableGainSet; MI_S16 s16FrontGain; MI_S16 s16RearGain; } MI_AI_ChnGainConfig_t;
Parameters | Description | Note |
---|---|---|
bEnableGainSet | Whether to set gain | The gain will be set only when it is TRUE |
s16FrontGain | Pre-stage gain | For Amic/Linein, the pre-stage gain is the analog gain. For other AI devices, it is the AI device gain. |
s16RearGain | Pro-stage gain | For Amic/Linein, the pro-stage gain is the digital gain. For other AI devices, it has no effect. |
Solution: In actual application (connected to linein), set s16FrontGain to 0 and use s16RearGain to adjust the gain.
...