Noise Cancellation
The Noise Cancellation feature is an invaluable tool designed to enhance the audio quality in scenarios such as conferences, live streams, and recordings where unwanted background noise can degrade the listening experience. By leveraging advanced Artificial Intelligence (AI) algorithms, this feature intelligently identifies and suppresses extraneous sounds, ensuring clear and crisp audio output.
Key Benefits
-
Enhanced Audio Quality: Eliminates unwanted noise, including background chatter, clicks, claps, barking, and other sudden audio disturbances, resulting in a more pleasant listening experience for your audience.
-
Improved Clarity: Ensures that the primary audio content remains prominent and intelligible by reducing distractions caused by ambient noise.
-
Optimized Communication: Facilitates seamless communication in conferences and live streams by minimizing disruptions caused by environmental factors, thereby enhancing the overall professionalism of the presentation.
How it Works
The Noise Cancellation feature employs a sophisticated AI model trained specifically to discern between desired audio signals and unwanted noise. Upon detecting extraneous sounds in the microphone input, the algorithm analyzes the audio waveform in real-time and generates an inverse sound wave, effectively canceling out the unwanted noise. This process occurs seamlessly and in near-real-time, preserving the integrity of the primary audio content without introducing noticeable delays.
Minimum Requirements
@100mslive/react-native-hms
version 1.10.2 or later is required to utilize the Noise Cancellation feature in your React Native application.
IMPORTANT
Enable Noise Cancellation in the template configuration. Learn more about enabling this feature from here
Usage
Step 1: Create instance of HMSNoiseCancellationPlugin
const noiseCancellationPlugin = new HMSNoiseCancellationPlugin();
Step 2: Create instance of HMSAudioTrackSettings
let audioSettings = new HMSAudioTrackSettings({ initialState: HMSTrackSettingsInitState.MUTED // The noise cancellation plugin to use for the audio track. @type {HMSNoiseCancellationPlugin}
noiseCancellationPlugin,}); let trackSettings = new HMSTrackSettings({ audio: audioSettings, });
Step 3: Pass the Track Settings to the HMSSDK
const hmsInstance = await HMSSDK.build({
trackSettings,});
Step 4: Enable Noise Cancellation after Joining the Room
await noiseCancellationPlugin.enable();
To disable the noise cancellation, you can use the disable
method.
await noiseCancellationPlugin.disable();
To check the current status of the noise cancellation, you can use the isEnabled
method.
const isEnabled = await noiseCancellationPlugin.isEnabled();
Complete Code Example
const noiseCancellationPlugin = new HMSNoiseCancellationPlugin(); let audioSettings = new HMSAudioTrackSettings({ initialState: HMSTrackSettingsInitState.MUTED // The noise cancellation plugin to use for the audio track. @type {HMSNoiseCancellationPlugin} noiseCancellationPlugin, }); let trackSettings = new HMSTrackSettings({ audio: audioSettings, }); const hmsInstance = await HMSSDK.build({ trackSettings, }); hmsInstance.addEventListener( HMSUpdateListenerActions.ON_JOIN, () => { console.log("Joined Room"); // Noise Cancellation can be enabled only after Joining the Room noiseCancellationPlugin.enable().then(() => { console.log("Noise Cancellation Enabled"); }); } } ); let hmsConfig = new HMSConfig({...}); // Your config object hmsInstance.join(hmsConfig)
Check if Noise Cancellation is Supported in the Room
By default, Noise Cancellation is not enabled in a Room. To enable Noise Cancellation in your rooms, reach out to support@100ms.live.
const isAvailable = await noiseCancellationPlugin?.isNoiseCancellationAvailable();