Android Low-Latency Audio Modem

Job ID: 40146336

Budget: $30 – $250 USD

I am building a proof-of-concept Android application that behaves like an “audio modem,” pushing and pulling live audio through a WebSocket connection with the absolute minimum possible latency. The primary scene is real-time audio streaming, so every design decision should favour tight buffering, fast reconnection and clean, uninterrupted playback.

Here is what I need from you:

• A lightweight Android app (Java or Kotlin) that opens a configurable WebSocket endpoint, captures audio
We need an Android app that runs on a **Redmi 4A (Android 7)** device the app will capture audio from the headset mic via loopback cable and send it to our backend over **WebSocket**, using **Opus encoding**. Incoming audio from WebSocket must be decoded and played back into the headset output
it is a **low-latency audio modem**.

---

## **Device & Platform Constraints**

* Device: **Redmi 4A**
* Android version: **7.x (Nougat)**
* Audio routing will be enforced by our **Magisk module** (already handled by another developer)
* SIM call audio is already forced to wired headset through 3.5mm TRRS loopback cable

---

## **What the App Must Do**

### **A. WebSocket Audio Transport**

* Connect to backend via **secure WebSocket (wss://)**
* Send **uplink audio**: captured mic → Opus → WebSocket
* Receive **downlink audio**: WebSocket → Opus → AudioTrack
* Must support:

* auto reconnect
* error reporting
* configurable server URL
* configurable device ID

### **B. Audio Capture & Playback**

App will use **native Android audio APIs**, NOT WebRTC:

* **Capture**:

* `AudioRecord`
* 8000 Hz, mono, 16-bit PCM
* converted to Opus (frame size 20ms)

* **Playback**:

* `AudioTrack`
* 8000 Hz, mono, 16-bit PCM (decoded from Opus)

### **C. Call State Driven**

App must detect SIM call states using `TelephonyManager`:

* When SIM enters **OFFHOOK**:

* Connect WebSocket (if disconnected)
* Start streaming audio uplink/downlink

* When SIM returns to **IDLE**:

* Stop streaming
* Option to close or keep socket alive (configurable)

### **D. Codec**

Use **Opus** (NOT WebRTC stack, NOT WebRTC AEC/NS/AGC)

Codec profile:

* Sample rate: **8000 Hz**
* Channels: **mono**
* Bitrate target: **12–16 kbps**
* Frame size: **20 ms**
* Transport: **binary frames over WebSocket**

### **E. Permissions**

App needs:

* `RECORD_AUDIO`
* `MODIFY_AUDIO_SETTINGS`
* `READ_PHONE_STATE`
* `INTERNET`
* `WAKE_LOCK`
* (optional) `RECEIVE_BOOT_COMPLETED` for auto-start

---


---

## **Backend Compatibility**

Backend will accept frames as:

```
[frame_header][opus_payload]
```

And will respond with similar frames.

Exact header spec will be provided.

---

## **UI Requirements**

Minimal UI:

Main screen shows:

* Device ID
* WebSocket state: DISCONNECTED / CONNECTING / CONNECTED
* Call state: IDLE / OFFHOOK
* Last error / reconnect attempts

Settings screen:

* WebSocket URL
* Device ID
* Toggle: “Start on boot”
* Toggle: “Disconnect when no call”
* Toggle: “Auto reconnect”

---

## **Deliverables**

Freelancer must deliver:

1. **Android Studio project**

2. **Signed APK (debug OK)**

3. **Source code on GitHub or zip**

4. **Simple README** with:

* build steps
* required permissions
* run instructions

5. **Test video** demonstrating:

* outgoing SIM call → audio uplink/downlink over WebSocket
* incoming SIM call → same behavior
* disconnect/reconnect handling
* call end handling

---

## **Bonus Points (Not Required in v1)**

If you can do these, indicate separately:

* Background foreground service mode
* Network status awareness

* Audio buffer jitter smoothing
* Automatic Opus bitrate adaptation
* TLS pinning for WebSocket

---



* Backend team that:

* handles SIP/RTP/VoIP
* handles AI voice
* handles IVR logic

So you do **front-end audio only**.

---

## **Required Skills**

Developer **must have**:

* Android native audio (`AudioRecord` + `AudioTrack`)
* Opus codec integration (JNI or NDK)
* WebSocket client experience (OkHttp / Java-WebSocket, etc.)
* Telephony API (`PhoneStateListener`)
* Java/Kotlin (either OK)
* Good debugging/logging practice

---

## **Please Include in Proposal**

* Past experience with audio apps (very important)
* Whether you prefer Java or Kotlin
* Choice of Opus implementation:

* `libopus` via JNI (preferred), or
* pure-Java Opus (acceptable if stable)

---

## **Project Type & Duration**

* 1 developer
* Estimated v1 timeline: **1 week
* Possible follow-on work:

* jitter buffer
* dual SIM
* encryption
* monitoring
* provisioning 100+ nodes