Skip to content

JaeBinCHA7/RTNR

Repository files navigation

Real-Time-Noise-Reducer

RTNR enables the use of deep learning-based real-time speech enhancement technology in the Android mobile environment. When given a certain audio sample, it immediately outputs noise-removed speech.

Demo

real_time_speech_enhancement_android_app.mp4

Usage

Step 1

Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Step 2

Add the dependency

dependencies {
        implementation 'com.github.JaeBinCHA7:RTNR:Tag'
}

Step 3

Declare the RTNR class (rtNoiseReducer) in your class.

void initRTNR(){
    try {
        rtNoiseReducer = new rtNoiseReducer(getActivity());
    } catch (IOException e) {
        Log.d("class", "Failed to create noise reduction");
    }
}

Step 4

Input audio samples as many as 256 double arrays to the audioSE() function of the rtNoiseReducer class. In this example, the data type for audio playback is a byte type, so I converted it to a double type.

short[] shortData = byteArrayToShortArray(writeData); // 512 -> 256
double[] doubleData = shortArrayToDoubleArray(shortData); // 256 -> 256
double[] se_out = rtNoiseReducer.audioSE(doubleData);
shortData = doubleArrayToShortArray(se_out);
writeData = shortArrayToByteArray(shortData);

For a detailed example, see the link. [code]

Requirements

This repo is tested with Ubuntu 20.04, Tensorflow 2.9, Python3.7, CUDA11.6. For package dependencies