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.
  • 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.


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

The AI noise suppression modes. See AudioAinsMode.


  • 0: Success.
  • < 0: Failure.