noise-suppresion
Noise suppression · MD Copy
sidebar_label: Noise Suppression pagination_label: Noise Suppression
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.
- Noise suppression from the
VideoSDKMediaEffectsplugin 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_effectsplugin. - Calling
startNoiseSuppression()when it is already active will throw aStateError. Similarly, callingstopNoiseSuppression()when it is already inactive will throw aStateError.
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

