AI Noise Cancellation for Mobile Call Apps
The Problem: Background Noise in Mobile Calls
When you open the microphone via AVAudioSession on iOS or AudioRecord on Android, you get a raw PCM stream — with everything around the user. Construction work, coffee machines, children — all of it goes into the call. The standard Acoustic Echo Cancellation (AEC) from WebRTC removes echo but not background noise. We implement turnkey integration of ML noise suppression models — from architecture selection to publication in app stores. Our engineers have 5+ years of experience in audio processing and have delivered over 30 projects with voice interfaces.
How AI Noise Suppression Differs from Standard DSP
Classic approaches — spectral subtraction or Wiener filter: the noise model is estimated during speech pauses, then subtracted from the spectrum. Works for stationary noise (fan hum), fails on non-stationary noise (subway chatter, nearby keyboard).
AI approach — a neural network trained on pairs of clean speech + noisy speech predicts a mask for each spectrogram frame. Models like RNNoise or DTLN operate in real time, processing 10–20 ms frames with sub-frame latency.
How Real-Time AI Noise Cancellation Works
The ML model receives the signal's spectrogram, computes the probability of speech in each frequency bin, and applies a filter. This allows noise suppression even while the person is speaking — unlike gates. Voice Activity Detection (VAD) further reduces load by passing only speech segments.
Model Comparison: RNNoise vs DTLN
| Parameter |
RNNoise |
DTLN |
| Model Size |
~90 KB |
~2 MB |
| Latency |
<1 ms |
8–35 ms (device-dependent) |
| Suppression Quality |
Good for stationary noise |
Excellent for complex, multi-component noise |
| Platform Support |
C library (iOS/Android via NDK) |
TFLite (Android) / Core ML (iOS) |
| Recommendation |
Budget devices, resource constraints |
Flagships, high quality requirements |
RNNoise: Quick Start on Both Platforms
RNNoise from Mozilla is a C library, 90 KB, ~2 MFLOPS per frame. It compiles into a static library for iOS (xcframework) and Android (AAR with native part via NDK).
// Initialization
DenoiseState *st = rnnoise_create(NULL);
// Process a frame (480 samples = 10 ms at 48 kHz)
float frame[480];
// ... fill from microphone buffer
float vad_prob = rnnoise_process_frame(st, frame, frame);
// frame now contains clean signal
// vad_prob > 0.5 — likely speech
Integration on iOS: AVAudioEngine with a custom AVAudioSinkNode or a tap on the input node. Format — Float32, 48 kHz, mono. AVAudioSession must be configured with mode: .voiceChat and system processing explicitly disabled, otherwise iOS applies its own noise reduction on top of yours.
let inputNode = audioEngine.inputNode
let format = inputNode.outputFormat(forBus: 0)
inputNode.installTap(onBus: 0, bufferSize: 480, format: format) { [weak self] buffer, _ in
guard let self = self else { return }
let channelData = buffer.floatChannelData![0]
// Pass to rnnoise_process_frame via C-bridge
self.rnnoiseProcessor.process(channelData, frameLength: Int(buffer.frameLength))
}
On Android — AudioRecord with AudioFormat.ENCODING_PCM_FLOAT, buffer size of 480 samples, processing in a separate thread with Process.THREAD_PRIORITY_URGENT_AUDIO. Call the same C library via JNI.
DTLN and Heavier Models
If RNNoise is insufficient (complex multi-component noise, multiple sources), we use DTLN — a two-stage LSTM model. It is converted to TFLite (Android) or Core ML (iOS).
In practice: DTLN at 16 kHz takes 8–14 ms per frame on iPhone 12, well within real-time. On Android Snapdragon 778G — similar. On budget Helio G85 — 25–35 ms, which creates cumulative latency.
For mobile use, choosing the sample rate is important: 16 kHz instead of 48 kHz reduces computational load by a factor of four, and for speech, bandwidth up to 8 kHz is sufficient for intelligibility.
Integration into WebRTC
WebRTC SDKs (LiveKit, Agora, Daily) provide AudioProcessingModule or a hook before encoding. In native WebRTC for iOS — custom RTCAudioProcessingModule:
// Register custom processing
let config = RTCConfiguration()
// Create RTCPeerConnectionFactory with custom AudioDeviceModule
// or use AudioProcessingConfig for WebRTC built-in replacement
Important nuance: WebRTC already includes AECM and NS (Noise Suppression). When enabling your own AI noise suppression, you need to disable the built-in NS via AudioProcessingConfig, otherwise double processing creates artifacts — "metallic" sound, clipped consonants.
What's Included in the Work (Deliverables)
- Audit of the current audio pipeline in the app
- Model selection (RNNoise/DTLN/custom) based on latency and quality requirements
- Compilation of native libraries for target architectures (arm64, x86_64 for simulator)
- Integration into existing audio stack (AVAudioEngine, AudioRecord, WebRTC)
- VAD tuning and elimination of double processing (disabling built-in NS)
- Testing with real-world noises (subway, street, office)
- Documentation and support for app store publication
Common Pitfalls in Implementation
- Forgetting to disable built-in noise suppression in WebRTC — results in "metallic" sound.
- Using 48 kHz for DTLN — latency becomes unacceptable.
- Not configuring VAD — model wastes resources on silence.
- Not checking compatibility across Android versions (AudioRecord has bugs on some firmware).
Estimated Timelines
Integration of RNNoise into an existing WebRTC stack: 1–2 weeks. Full implementation with DTLN/TFLite, VAD tuning, and dual-platform support: 3–5 weeks. Cost is calculated individually. Contact us for an assessment of your project — we will find the optimal solution and provide a consultation.
Machine Learning in Mobile Apps: CoreML, TFLite, and On-Device Models
We distinguish two fundamentally different approaches: an app with on-device AI and an app that simply calls a cloud API. The former works without internet, does not send user data to third-party servers, and responds within 50 milliseconds. The latter depends on network latency and pricing plans. Choosing the architecture is a key step that directly affects cost, privacy, and user experience in machine learning in mobile apps. Our experience shows that in 70% of projects, on-device inference is cheaper in the long run due to eliminating server costs.
How to Choose Between CoreML and TFLite for On-Device Inference?
CoreML — Apple's native framework for running ML models on device. Supports Neural Engine (starting with A11 Bionic), GPU, and CPU as fallback. Models are converted to .mlmodel format via coremltools from PyTorch, ONNX, or TensorFlow. Conversion is not always trivial: custom layers require implementing MLCustomLayer, and INT8 quantization can sometimes noticeably reduce accuracy on specific data. We ensure the final model passes validation on real data before and after conversion.
TensorFlow Lite — cross-platform alternative for Android and Flutter. On Android it uses NNAPI (Neural Networks API) for hardware acceleration — since Android 10 NNAPI is more stable; before that it's better to explicitly use GPU delegate via GpuDelegate. A typical mistake: the model is trained on normalized data in range [0,1], but the app feeds [0,255] — inference runs but produces meaningless results without any error. We include an automatic input data validation module in the SDK.
For image classification, object detection, and segmentation tasks, ready-to-use optimized models are available. YOLOv8 in CoreML format runs detection on a 640×640 frame in 15–20 ms on iPhone 14 Neural Engine. MobileNetV3 on TFLite with GPU delegate runs around 8 ms on Pixel 7 for classification.
| Parameter |
CoreML |
TFLite |
| Platforms |
iOS, macOS, watchOS |
Android, iOS, Linux, embedded |
| Hardware acceleration |
Neural Engine, GPU, CPU |
NNAPI, GPU (OpenCL/OpenGL), CPU |
| Quantization support |
FP16, INT8 (with coremltools) |
FP16, INT8, dynamic range |
| Custom operations |
Via MLCustomLayer (Swift) |
Via delegates (Java/Kotlin) |
| Model bundle size |
~3–5 MB (MobileNetV2 quantized) |
~2–4 MB |
What If You Need Text Generation On-Device?
Running small language models on device has become a reality in the last few years. Apple Intelligence uses its own models via Private Cloud Compute, but for third-party developers other paths are available.
llama.cpp with Metal backend on iOS is a working approach for phi-3-mini (3.8B parameters, 4-bit quantization, ~2.3 GB). Inference: 15–25 tokens/second on iPhone 15 Pro. For integration in Swift, use the Swift Package llama.swift or a wrapper via C interface llama.h. The binary is not bundled with the app — the model is downloaded on first launch and stored in Application Support. Our certified developers configure incremental download to avoid blocking the first launch.
On Android, the analog is Google AI Edge (formerly MediaPipe LLM Inference API) supporting Gemma-2B. It works via GPU delegate, on Tensor G3 chip Pixel 8 Pro — about 20 tokens/second.
Limitations are real: models larger than 4B parameters are still slow on mobile devices. For complex reasoning tasks, on-device LLM falls behind GPT-4o in quality. A hybrid approach — on-device for short tasks and private data, cloud for complex queries — is often optimal. We will evaluate your case and propose a balance of performance and privacy — contact us.
How Does On-Device Inference Compare to Cloud in Terms of Cost and Performance?
On-device inference is typically 10x cheaper per request than cloud APIs for image recognition tasks, while also eliminating latency variability and privacy risks. The table below summarizes the trade-offs.
| Criteria |
On-Device Inference |
Cloud API |
| Latency |
<50ms |
200–500ms (including network) |
| Cost per 1M requests |
$0 (no server) |
$10–50 (AWS Rekognition, Google Vision) |
| Privacy |
Data stays on device |
Data sent to server |
| Offline |
Yes |
No |
| Scalability |
No server scaling issues |
Need to provision API capacity |
For an app with 100k MAU running 10 image recognitions per user per month, on-device inference can save up to $5,000 monthly compared to cloud API. Get a free consultation on your ML architecture today.
Integrating OpenAI API and Other Cloud Models
For scenarios where cloud inference is acceptable, integrating OpenAI, Anthropic, or Google Gemini is an HTTP client + streaming SSE. In Swift, AsyncThrowingStream is convenient for streaming responses. In Kotlin, use Flow.
Critically: API keys must never be stored in the app bundle. Even an obfuscated key can be extracted from the IPA in 10 minutes using strings or frida. Correct architecture: mobile app → your own backend → OpenAI API. The backend controls rate limiting, logs requests, and protects the key.
What Is Included in the Work (Deliverables)
- Trained and quantized model for the target device (documentation with metrics)
- SDK for integration (Swift/Kotlin/Flutter) with call examples
- Performance tests on 3–5 real devices
- Instructions for OTA model updates
- Support during App Store / Google Play moderation (compliance with Guidelines 4.2, 5.1)
- 2 weeks of technical support after release
Typical Project Pipeline
-
Task analysis — measure latency, privacy, size, supported devices.
-
Model prototyping — in Python, evaluate accuracy on target data.
-
Conversion and quantization — for CoreML/TFLite with validation.
-
Integration into the app — model wrapped in a service layer (easy to swap CoreML ↔ TFLite ↔ cloud).
-
Testing — on real devices, measure FPS, RAM, battery.
-
Deployment — via TestFlight / Firebase App Distribution, monitor metrics.
Timelines: integration of a ready CoreML/TFLite model — 1–2 weeks, development of a custom model with mobile optimization — from 6 weeks, on-device LLM chat with personalization — 4–8 weeks.
Why We Take on Complex Cases?
10+ years of experience in mobile development, 50+ implemented AI/ML solutions, guarantee of compatibility with current iOS and Android versions. All projects undergo code review and load testing. The cost includes preparation of moderation documentation and training of your team.
Contact us — we will help you choose the architecture and implement ML in your app turnkey. Order an audit of your existing solution — we will assess the potential for server cost savings free of charge. In some projects, savings can reach significant amounts per month.