setAINSMode

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

abstract setAINSMode(enabled: boolean, mode: AudioAinsMode): number;
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.

Applicable scenarios

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

Call timing

You can call this method either before or after joining a channel.

Restrictions

  • This method relies on the AI noise suppression dynamic library. If the dynamic library is deleted, the function cannot be enabled. For the name of the AI ​​noise suppression dynamic library, see App size optimization.
  • Agora does not recommend enabling this function on devices running Android 6.0 and below.

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.

Returns

  • 0: Success.
  • < 0: Failure.