Mobile Development 14 min read

Noise Reduction in Live Streaming: Comparative Study and Integration of WebRTC and RNNoise on Android

This article examines the challenges of live‑stream audio noise, compares open‑source denoising solutions such as Speex, WebRTC, and RNNoise, and details the practical integration, performance testing, and final adoption of WebRTC‑based noise reduction within the 58 live‑stream Android SDK.

58 Tech
58 Tech
58 Tech
Noise Reduction in Live Streaming: Comparative Study and Integration of WebRTC and RNNoise on Android

During live streaming, external noises are captured together with the host’s voice, degrading the audience’s listening experience; therefore a proactive denoising solution on the broadcaster side is required.

58 Live evaluated three popular open‑source denoising libraries—Speex, WebRTC, and RNNoise—by comparing their processing results and integration effort, ultimately selecting WebRTC for its balance of quality and compatibility.

Common Open‑Source Denoising Solutions

Speex : a free, patent‑free speech codec that also provides VAD, DTX, AEC, and NS modules.

WebRTC : a comprehensive real‑time communication framework offering audio processing via the audio_processing module, supporting multiple platforms.

RNNoise : a GRU‑based deep‑learning denoiser that requires trained models (rnn_data.h/c) and operates on fixed‑size frames.

RNNoise Integration Process

Implemented as C code compiled with the Android NDK.

Adapted the original file‑based test to handle segmented byte‑array streams, defining init , process , and free APIs.

Discovered the required frame size of 480 bytes; non‑multiple inputs introduce artifacts.

#define FRAME_SIZE_SHIFT 2
#define FRAME_SIZE (120<<FRAME_SIZE_SHIFT)
#define WINDOW_SIZE (2*FRAME_SIZE)

Adjusted frame size to 512 bytes to accommodate non‑multiple inputs, accepting minor residual noise.

// Force modify FRAME_SIZE
#define FRAME_SIZE (128<<FRAME_SIZE_SHIFT)

Training data is essential; without a suitable dataset, RNNoise may suppress desired speech.

WebRTC Integration Process

Ported C++ code via NDK.

Identified supported sample rates (8000, 16000, 32000, 44100, 48000) and added resampling logic for other rates.

Window size must be a multiple of 160 or 320 bytes; mismatched sizes cause new noise.

// WebRTC supported sample rates
if (fs == 8000 || fs == 16000 || fs == 32000 || fs == 44100 || fs == 48000) {
self->fs = fs;
} else {
return -1;
}

Implemented gain compensation because WebRTC’s NS reduces overall volume.

if (fs == 8000) {
self->blockLen = 80;
self->anaLen = 128;
self->window = kBlocks80w128;
} else {
self->blockLen = 160;
self->anaLen = 256;
self->window = kBlocks160w256;
}

Performance and Feature Comparison

WebRTC supports only specific sample rates; RNNoise is agnostic.

WebRTC requires additional gain processing, which may re‑introduce hiss.

Both need fixed‑size buffers (WebRTC 320‑byte multiples, RNNoise 480‑byte multiples).

WebRTC processes 3840‑byte buffers in ~2 ms after warm‑up; RNNoise takes ~6 ms.

Final Integration in 58 Live Android SDK

The team encapsulated the denoising logic into an APM (Audio Processing Module) with a public AudioNoiseHelp utility, handling resampling, buffer segmentation, and asynchronous callbacks.

void resampleData(const int16_t *sourceData, int32_t sampleRate, uint32_t srcSize, int16_t *destinationData, int32_t newSampleRate) {
if (sampleRate == newSampleRate) {
memcpy(destinationData, sourceData, srcSize * sizeof(int16_t));
return;
}
uint32_t last_pos = srcSize - 1;
uint32_t dstSize = (uint32_t)(srcSize * ((float)newSampleRate / sampleRate));
for (uint32_t idx = 0; idx < dstSize; idx++) {
float index = ((float)idx * sampleRate) / newSampleRate;
uint32_t p1 = (uint32_t)index;
float coef = index - p1;
uint32_t p2 = (p1 == last_pos) ? last_pos : p1 + 1;
destinationData[idx] = (int16_t)((1.0f - coef) * sourceData[p1] + coef * sourceData[p2]);
}
}

WebRTC was ultimately chosen for its lower latency and easier integration, and extensive testing showed clearer waveforms, reduced spectral noise, and improved subjective listening quality when the denoising feature is enabled.

Conclusion

The article shares 58 Live’s research, challenges, and solutions for audio denoising in live streaming, highlighting the trade‑offs between RNNoise and WebRTC and providing concrete implementation details for Android developers.

live streamingAndroidAudio ProcessingWebRTCnoise reductionRNNoise
58 Tech
Written by

58 Tech

Official tech channel of 58, a platform for tech innovation, sharing, and communication.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.