setAINSMode

Sets whether to enable the AI ​​noise suppression function and set the noise suppression mode.

Future<void> setAINSMode(
      {required bool enabled, required AudioAinsMode mode});

Details

You can call this method to enable AI noise suppression function. Once enabled, the SDK automatically detects and reduces stationary and non-stationary noise from your audio on the premise of ensuring the quality of human voice. Stationary noise refers to noise signal with constant average statistical properties and negligibly small fluctuations of level within the period of observation. Common sources of stationary noises are:
  • Television;
  • Air conditioner;
  • Machinery, etc.
Non-stationary noise refers to noise signal with huge fluctuations of level within the period of observation; common sources of non-stationary noises are:
  • Thunder;
  • Explosion;
  • Cracking, etc.
Note:
  • Agora does not recommend enabling this function on devices running Android 6.0 and below.

Applicable scenarios

In scenarios such as co-streaming, online education and video meeting, this function can detect and reduce background noises to improve experience.

Parameters

enabled
Whether to enable the AI noise suppression function:
  • true: Enable the AI noise suppression.
  • false: (Default) Disable the AI noise suppression.
mode

The AI noise suppression modes. See AudioAinsMode.

Exceptions

When the method call succeeds, there is no return value; when fails, the AgoraRtcException exception is thrown. You need to catch the exception and handle it accordingly.