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});
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.
- 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.
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.