![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
rtc-ai-denoiser-infinity
Advanced tools
The RTCAIDenoiser plugin can be used in conjunction with the TRTC Web SDK to reduce noise during calls and reduce the impact of ambient sound on calls.
This article describes how to use the RTCAIDenoiser plugin in developing TRTC applications to apply AI noise reduction to streams when publish. Click to experience the noise reduction demo online.
Supported browsers: Chrome 66+, Edge 79+, Safari 14.1+, Firefox 76+.
For better use of AI noise reduction, it is recommended that you use the latest version of Chrome.
Notes:
If there is background music captured by your microphone, RTCAIDenoiser
may eliminate it as noise.
npm install rtc-ai-denoiser@latest
The RTCAIDenoiser
plugin needs to be installed in the same scope as TRTC
.
import TRTC from 'trtc-js-sdk';
import RTCAIDenoiser from 'rtc-ai-denoiser';
Dynamically loading file dependencies: The RTCAIDenoiser plugin relies on a number of files. To ensure that your browser can load and run these files properly, you need to complete the following steps.
Publish the denoiser-wasm.js
file from the node_modules/rtc-ai-denoiser/assets
directory to a CDN
or static resource server and under the same public path. When creating RTCAIDenoiser
instances later, you need to pass in the URL of the above public path and the plugin will load the dependency files dynamically.
- If the Host URL of the file in the assets directory does not match the Host URL of the web application, you need to enable the CORS policy for accessing the file domain.
- You cannot place assets directory files under an HTTP service, as loading HTTP resources under an HTTPS domain is prohibited by browser security policies.
Reference Quick Start Call to implement a basic audio/video call process.
init RTCAIDenoiser
// Create an instance, passing in the public path where the files in the assets directory are located
const rtcAIDenoiser = new RTCAIDenoiser({ assetsPath: './assets' });
const processor = await rtcAIDenoiser.createProcessor({
sdkAppId,
userId,
userSig
});
// init stream
const localStream = TRTC.createStream({ video: true, audio: true });
await localStream.initialize();
// adding noise suppression to localStream
await processor.process(localStream);
// publish
await client.publish(localStream);
enable
method and the disable
method.if (processor.enabled) {
await processor.disable();
} else {
await processor.enable();
}
startDump
method to start and the stopDump
method to end, and listen to the ondumpend
callback to get the audio and video data.processor.on('ondumpend', ({ blob, name }) => {
const url = window.URL.createObjectURL(blob);
let anchor = document.createElement('a');
anchor.href = url;
anchor.download = `${name}-${Date.now()}.wav`;
anchor.click();
window.URL.revokeObjectURL(url);
anchor.href = '';
});
const rtcAIDenoiser = new RTCAIDenoiser({ assetsPath: './assets' })
Determine whether the current environment supports RTCAIDenoiser.
if (!rtcAIDenoiser.isSupported()) {
console.log('Your browser is not supported RTCAIDenoiser');
}
create denoiserProcessor instance.
const denoiserProcessor = await rtcAIDenoiser.createProcessor({
sdkAppId,
userId,
userSig
});
Params:
Name | Type | Description |
---|---|---|
sdkAppId | number | sdkAppId that your application use |
userId | string | userId that current client use |
userSig | string | userSig signature |
Add noise suppression to the audio of the local stream.
await denoiserProcessor.process(localStream);
Whether AI noise suppression is currently turned on.
const enabled = denoiserProcessor.enabled
Turn on AI noise reduction.
await denoiserProcessor.enable()
Turn off AI noise reduction.
await denoiserProcessor.disable()
Start dumping audio data from the noise reduction process. Up to 30 seconds.
denoiserProcessor.startDump()
Stop dumping audio data from the noise reduction process. Up to 30 seconds.
denoiserProcessor.stopDump()
add event listener to events from the processor.
eg:
After listening to the ondumpend
event, the audio data is dumped and the example code is as follows.
denoiserProcessor.on('ondumpend', ({ blob, name }) => {
const url = window.URL.createObjectURL(blob);
let anchor = document.createElement('a');
anchor.href = url;
anchor.download = `${name}-${Date.now()}.wav`;
anchor.click();
window.URL.revokeObjectURL(url);
anchor.href = '';
});
remove event listener to events from the processor.
Destroy the processor to release resources and end the processor life cycle.
Optimize the destruction logic and reduce memory usage.
Improve the noise reduction effect.
Optimize the authentication strategy.
Optimize the error message.
Released version 1.0.0.
FAQs
AI denoiser plugin for TRTC Web SDK
We found that rtc-ai-denoiser-infinity demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.