1.1. include the libwebrtc.aar
into the Android project.
1.2. import org.webrtc.KrispAudioProcessingImpl
1.3.
var audioProcessorModule = KrispAudioProcessingImpl()
2.1. Load the stdlib required by Krisp Audio SDK. Load it before using Krisp.
System.loadLibrary("c++_shared")
2.2. Load the jingle_peerconnection_so. The library is required to use WebRTC on Android.
System.loadLibrary("jingle_peerconnection_so")
You can load Krisp model specifying file path. For this scenario you should make sure the Android app has access to the file resource.
val modelFilePath = “c6.f.s.ced125.kw”
val krispDllpath = "libkrisp-audio-sdk.so"
var retValue = audioProcessorModule.Init(modelFilePath, krispDllpath)
if (!retValue) {
// report error, read the logs for the details
}
Make sure to specify correct file paths, these are hard coded sample values.
Alternatively, you can load Krisp model by specifying model data content loaded into the memory.
var modelData: ByteArray // = load the model into the memory
audioProcessorModule.InitWithData(modelData, krispDllpath)
if (!retValue) {
return null
}
to enable Krisp NC during runtime
audioProcessorModule.Enable(true)
to disable Krisp NC
audioProcessorModule.Enable(false)
PeerConnectionFactory
.builder()
.setAudioProcessingFactory(audioProcessorModule)
mkdir workdir
cd workdir
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=`pwd`/depot_tools:$PATH
fetch --nohooks webrtc_android
cd src
git checkout branch-heads/6478
git checkout -b 6478-modified a18e38fed2307edd6382760213fa3ddf199fa181
cd ..
gclient sync
cd src
git clone [email protected]:krispai/webrtc-android-krisp-module.git
Add krisp_processor library into the dependency list of the rtc_shared_library(“libjingle_peerconnection_so”)
deps = [ “../../webrtc-android-krisp-module:krisp_processor”, ….]
Add krisp_java library into the dependency list of the dist_jar(“libwebrtc”), for creating public java modules
deps = [ “../../webrtc-android-krisp-module:krisp_java”, ….]
See the screenshot.
python3 tools_webrtc/android/build_aar.py
ls libwebrtc.aar