Function Introduction
The AI Denoiser plugin can reduce noise in calls and minimize the impact of environmental noise on communication. It can effectively suppress keyboard sounds, collisions, and other noises during calls, making it particularly suitable for scenarios where transient noise is sensitive, such as in conference settings.
This article will introduce how to apply AI Denoiser to the local audio stream in TRTC applications. Click here to experience it online for the denoising demo.
Prerequisites
For usage fee instructions, please see TRTC Edition Features and Pricing.
Supported browsers: Chrome 66+, Edge 79+, Safari 14.1+, Firefox 76+. For Android systems, Chrome version needs to be above 92.
To make the best use of AI Denoiser, it is recommended to use the latest version of Chrome browser.
Note:
If there is background music in the microphone input, the denoising plugin may treat it as noise and eliminate it.
Implementation Process
Deploy Static Resources
This plugin relies on some static resource files. To ensure that the browser can load and run these files properly, you need to complete the following steps:
- Publish the
node_modules/trtc-sdk-v5/assets
directory to a CDN or static resource server. - Pass your CDN address to the
assets
parameter when creating the TRTC instance, for example:TRTC.create({ assets: 'https://xxx/assets' })
. The SDK will load the relevant resource files as needed.
- If your version is below
v5.10.0
, you need to publishnode_modules/trtc-sdk-v5/plugins/ai-denoiser/denoiser-wasm.js
to the CDN and place it in the same public directory, such asxxx/assets
.- If the Host URL of the files in the directory is different from the Host URL of the web application, you need to enable the CORS policy for the file domain.
- Do not place the directory files under an HTTP service, as loading HTTP resources under an HTTPS domain will be blocked by browser security policies.
Enable Denoising
const trtc = TRTC.create({ assets: 'https://xxx/assets' });
await trtc.startLocalAudio();
await trtc.startPlugin('AIDenoiser', {
sdkAppId: 123456,
userId: 'user_123',
userSig: 'XXXXXXXX'
});
Disable Denoising
await trtc.stopPlugin('AIDenoiser');
API Description
trtc.startPlugin('AIDenoiser', options)
Used to enable denoising.
options:
Name | Type | Attributes | Description |
---|---|---|---|
assetsPath | string |
The location where the denoiser-wasm.js file is stored. If your version is below v5.5.2 , you need to pass the assets resource directory through this parameter. |
|
sdkAppId | number |
The sdkAppId of the current application | |
userId | string |
The userId of the current user | |
userSig | string |
The userSig of the current user |
trtc.stopPlugin('AIDenoiser')
Used to disable denoising