Skip to main content
Version: 3.x.x

noise-suppresion

Noise suppression · MD Copy


Noise Suppression - Flutter

Noise suppression is a feature that identifies and filters out background noise from an audio input during a meeting or call. This can be particularly useful in noisy environments or when participants are using low-quality microphones.

Noise Suppression with VideoSDKMediaEffects Plugin

The VideoSDKMediaEffects plugin provides noise suppression capabilities alongside virtual background effects. Noise suppression filters out ambient background noise for clearer audio during meetings.

info
  • Noise suppression from the VideoSDKMediaEffects plugin is supported only on Android and iOS devices. It is not available on web or desktop platforms.
  • Noise suppression is available from version 0.0.5 of the videosdk_media_effects plugin.
  • Calling startNoiseSuppression() when it is already active will throw a StateError. Similarly, calling stopNoiseSuppression() when it is already inactive will throw a StateError.

Install the Plugin

Install the videosdk_media_effects plugin by running the following command inside your Flutter project directory:

flutter pub add videosdk_media_effects

startNoiseSuppression()

Enables noise suppression on the audio stream. This method is static and can be called directly on the VideosdkMediaEffects class.

try {
await VideosdkMediaEffects.startNoiseSuppression();
} catch (e) {
debugPrint("Error enabling noise suppression: $e");
}

Throws:

  • UnsupportedError — if called on web or desktop platforms.
  • StateError — if noise suppression is already enabled.

stopNoiseSuppression()

Disables native noise suppression. Call this when you want to turn off the feature.

try {
await VideosdkMediaEffects.stopNoiseSuppression();
} catch (e) {
debugPrint("Error disabling noise suppression: $e");
}

Throws:

  • UnsupportedError — if called on web or desktop platforms.
  • StateError — if noise suppression is already disabled.

Example

The example below demonstrates a simple toggle UI with two buttons — one to enable and one to disable noise suppression.

import 'package:flutter/material.dart';
import 'package:videosdk_media_effects/videosdk_media_effects.dart';

class NoiseSuppresionExample extends StatefulWidget {
const NoiseSuppresionExample({super.key});

@override
State createState() => _NoiseSuppresionExampleState();
}

class _NoiseSuppresionExampleState extends State {
bool _isNoiseSuppressionEnabled = false;

Future _enableNoiseSuppression() async {
try {
await VideosdkMediaEffects.startNoiseSuppression();
setState(() => _isNoiseSuppressionEnabled = true);
} catch (e) {
debugPrint("Error enabling noise suppression: $e");
}
}

Future _disableNoiseSuppression() async {
try {
await VideosdkMediaEffects.stopNoiseSuppression();
setState(() => _isNoiseSuppressionEnabled = false);
} catch (e) {
debugPrint("Error disabling noise suppression: $e");
}
}

@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: _isNoiseSuppressionEnabled ? null : _enableNoiseSuppression,
child: const Text("Enable Noise Suppression"),
),
const SizedBox(width: 12),
ElevatedButton(
onPressed: _isNoiseSuppressionEnabled ? _disableNoiseSuppression : null,
child: const Text("Disable Noise Suppression"),
),
],
);
}
}

The Enable button is active only when noise suppression is off, and the Disable button is active only when it is on — preventing redundant calls that would throw a StateError.

Got a Question? Ask us on discord