Building a Private Android Voice Assistant in My Own Voice
Most voice assistants send your audio to a server, and almost none of them sound like you. I wanted an assistant on my phone that listens, thinks and replies without any audio or text leaving the device, and that speaks in my own cloned voice. Nexus is my attempt at that, built for the Samsung Galaxy Z Fold7. It is written mostly in Kotlin, with C++ for the llama.cpp bridge.
Why I built it
Two products inspired it: Block's Dessa, for natural spoken conversation, and Wispr Flow, for dictating into any app. I wanted both in one app, running offline, with no account. I also wanted the voice to be mine, so that text read aloud on my phone sounds like me rather than a stock voice.
What it does
Nexus has five parts:
- Talk: hands-free conversation. You can interrupt it by talking over it. Replies start about a second after the AI answers, in a fast conversational voice.
- Read with my voice: select text in any app and choose Read with my voice, or share text to Nexus. On the Read tab you pick Realistic (my Chatterbox voice, a few seconds to start) or Fast (starts in about a second).
- System voice: Nexus registers as an Android text-to-speech engine, so Samsung Read aloud, Select to Speak, TalkBack and browsers can use the voice.
- Dictation keyboard: tap the mic, talk, tap again. It transcribes on the phone, removes filler words and self-corrections, and types into any app.
- Assistant: it can be set as the digital-assistant app on the side key, or opened with the phone's wake word.
The AI model is your choice. In Setup you can pick any GGUF model from Hugging Face and Nexus downloads it into its own private storage. The default is IRx-mini. Claude can be used instead with your own API key, which is kept only in the app's private storage.
How it works
The pipeline is a chain of small models, all running on the CPU:
- The microphone feeds Silero VAD v5, which detects when you are speaking.
- NVIDIA Parakeet TDT 0.6B v2 (int8, through sherpa-onnx) turns speech into text.
- A GGUF model running in llama.cpp, called through JNI, generates the reply. I use each model's own chat template with thinking turned off. The reply streams out as text and is split into sentences.
- Sentences go to a text-to-speech model and then to the speaker.
The code is split along those lines. Conversation.kt runs the listen, think, speak loop with barge-in and an echo guard. Engines.kt loads the models and runs a two-stage sentence pipeline. LocalLlm.kt wraps llama.cpp, and Brain.kt handles conversation memory, dictation cleanup and routing between the local model and Claude.
Why two voices
This was the most useful design decision. Chatterbox Turbo (q4 ONNX, on ONNX Runtime) gives the best likeness, but on the Fold7's CPU it runs at roughly real-time speed. That is fine for reading aloud: about 5 seconds before the first sentence, with short pauses between sentences when the phone is warm. It is too slow for back-and-forth conversation.
So live conversation uses Kyutai's Pocket TTS (int8, via sherpa-onnx), which streams audio and starts in about 1.3 seconds, at the cost of a weaker likeness. Reading uses Chatterbox. Rather than hide the trade-off, I exposed it as a choice.
Making Chatterbox usable on a phone
Two things keep it practical. First, the voice is conditioned once on a computer with tools/make_voice.py, so the phone only runs the text-to-speech parts. Second, the voice prefix's KV cache is computed once per launch rather than for every sentence. While reading, sentence N+1 is generated while sentence N is being decoded, which hides some of the latency. Decoding is greedy with a repetition penalty, and I wrote a byte-level BPE tokenizer in Kotlin (Gpt2Tokenizer.kt) that matches Chatterbox's tokenizer.json.
What I learned
- Measure voice quality instead of trusting your ears. I scored candidates by how closely they matched real recordings, using two speaker-verification models, WeSpeaker ResNet34 and NeMo TitaNet, and averaging cosine similarity. Pocket TTS scored 0.42, Chatterbox (500M) on a Mac scored 0.66, and Chatterbox Turbo q4 with a 10-second reference scored 0.70, which is what Nexus uses.
- Latency and quality rarely come in the same model. Matching the model to the task, streaming for conversation and higher quality for reading, worked better than looking for one compromise.
- Do expensive work once. Conditioning the voice offline and caching the prefix per launch moved cost off the hot path.
- Sentence-level streaming is the practical unit. Splitting the LLM's streamed text into sentences lets speech start before the full answer exists.
- Privacy needs explicit handling. The reference recording and the voice file made from it are git-ignored, because anyone holding them could clone the voice. I only recommend cloning your own voice or one you have explicit permission to use.
Setup in brief
You need macOS or Linux with the Android SDK, JDK 17, ffmpeg and uv, plus an arm64 Android 12+ phone with about 3 GB free. You clone the repository, add 10 to 30 seconds of clean speech as reference.wav, pair the phone over wireless debugging and run scripts/setup.sh. It downloads about 2 GB of models, builds, installs and copies the models to the phone. After that, you enable Nexus as the text-to-speech engine, the dictation keyboard and optionally the assistant in Setup.
Conclusion
Nexus is a combination of existing open models, wired together so that listening, thinking and speaking all stay on the phone. The main lesson is to pick the right model for each job and be honest about the trade-offs, which in this case meant two voices rather than one compromise.