setAINSMode

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

public abstract int setAINSMode(boolean enabled, int mode);

Details

Since
v4.2.0
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-hosting, 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:
  • 0: (Default) Balance mode. This mode allows for a balanced performance on noice suppression and time delay.
  • 1: Aggressive mode. In scenarios where high performance on noise suppression is required, such as live streaming outdoor events, this mode reduces nosies more dramatically, but sometimes may affect the original character of the audio.
  • 2: Aggressive mode with low latency. The noise suppression delay of this mode is about only half of that of the balance and aggressive modes. It is suitable for scenarios that have high requirements on noise suppression with low latency, such as sing together online in real time.

Returns

  • 0: Success.
  • < 0: Failure.