An open API service indexing awesome lists of open source software.

https://github.com/kaleyravideo/androiddeepfilternet

An open-source Android library for real-time noise suppression, powered by the DeepFilterNet model.
https://github.com/kaleyravideo/androiddeepfilternet

Last synced: 4 months ago
JSON representation

An open-source Android library for real-time noise suppression, powered by the DeepFilterNet model.

Awesome Lists containing this project

README

          

[![Release Version](https://img.shields.io/maven-central/v/io.github.kaleyravideo/android-deepfilternet?color=0881BE)](https://central.sonatype.com/artifact/io.github.kaleyravideo/android-deepfilternet)
[![Android CI](https://github.com/KaleyraVideo/AndroidDeepFilterNet/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/KaleyraVideo/AndroidDeepFilterNet/actions/workflows/tests.yml)
# 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:

```gradle
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

```kotlin
// 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](https://github.com/KaleyraVideo/AndroidDeepFilterNet/blob/main/app/src/main/java/com/kaleyra/androiddeepfilternet/filter/DeepAudioFilter.kt).

## Documentation

For detailed documentation on the API, see the [documentation](https://html-preview.github.io/?url=https://github.com/KaleyraVideo/AndroidDeepFilterNet/blob/main/noise-filter/doc/index.html).

## License

This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.

## Credits

This project is built upon a [fork](https://github.com/KaleyraVideo/DeepFilterNet) of the original [DeepFilterNet](https://github.com/rikorose/DeepFilterNet) work by Hendrik Schröter.

Further information regarding the optimization process of the DeepFilterNet model for running on a mobile device is available in this [document](https://github.com/KaleyraVideo/DeepFilterNet/blob/main/models/deepfilternet_model_optimization.md).

## Demo app audio samples

- Voice generated with [Narakeet](https://www.narakeet.com/).
- Background noise from [Soundjay](https://www.soundjay.com/).

## 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.