AndroidDeepFilterNet
An open-source Android library for real-time noise suppression, powered by the DeepFilterNet model.
Install / Use
/learn @KaleyraVideo/AndroidDeepFilterNetREADME
Android DeepFilterNet
This repository provides an Android implementation of the DeepFilterNet noise suppression model with JNI bindings.
Overview
DeepFilterNet is a state-of-the-art neural network architecture designed for real-time noise suppression in audio streams. This Android implementation allows developers to integrate high-quality noise removal capabilities into Android applications.
Features
- Real-time noise suppression for Android applications
- JNI bindings for efficient integration with native Android code
- Optimized for mobile performance
Library Requirements
- Android API level 21+ (Android 5.0 or higher)
- Android NDK r21+
- Gradle 7.0+
Audio Requirements
- Sample Rate: 48 kHz
- Audio Depth: 16-bit PCM
- Channels: Mono
Installation
Add the following to your app's build.gradle file:
dependencies {
// Option 1: Use DeepFilterNet with the model bundled directly in the library.
// Choose this if you prefer a self-contained solution and are okay with a larger app size.
implementation 'io.github.kaleyravideo:android-deepfilternet:x.y.z'
// Option 2: Use DeepFilterNet with the model downloaded on demand during initialization.
// Choose this if you want to minimize initial app size and download the model only when needed.
implementation 'io.github.kaleyravideo:android-deepfilternet-lazymodel:x.y.z'
}
The model size is ~8MB.
Usage
Basic Usage
// Initialize the DeepFilterNet instance.
val deepFilterNet = com.rikorose.deepfilternet.NativeDeepFilterNet(context)
// Set the noise attenuation level (dB).
deepFilterNet.setAttenuationLimit(30f)
..
// Get the DeepFilterNet's frame length.
val frameLength = deepFilterNet.frameLength.toInt()
// Allocate a new direct ByteBuffer with the given frame length to interact with the native code.
val byteBuffer = ByteBuffer.allocateDirect(frameLength).apply {
order(ByteOrder.LITTLE_ENDIAN) // Set byte order to match DeepFilterNet's expectation
}
..
// Process the audio frame using the DeepFilterNet model.
// The 'processFrame' method modifies the buffer in-place.
deepFilterNet.processFrame(byteBuffer)
..
// Release resources when done.
deepFilterNet.release()
For a full example, click here.
Documentation
For detailed documentation on the API, see the documentation.
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Credits
This project is built upon a fork of the original DeepFilterNet work by Hendrik Schröter.<br/> Further information regarding the optimization process of the DeepFilterNet model for running on a mobile device is available in this document.
Demo app audio samples
Contact
For questions or support, please open an issue on the GitHub repository or contact the Kaleyra Video team at cis-eu.video.engineering@tatacommunications.com.
