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.
real_time_speech_enhancement_android_app.mp4
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the dependency
dependencies {
implementation 'com.github.JaeBinCHA7:RTNR:Tag'
}
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");
}
}
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]
This repo is tested with Ubuntu 20.04, Tensorflow 2.9, Python3.7, CUDA11.6. For package dependencies