The Challenge: An Offline Bengali Voice Dialer
Building an offline voice dialer for a low-resource language like Bengali presents a unique set of challenges. For developer Dev Sarkar, the motivation was deeply personal: to create a simple tool for his elderly, non-English-speaking mother. The goal was an Android app that could understand Bengali nicknames or commands like "মাকে ফোন করো" (Call mom) and initiate a call, all without an internet connection. This meant relying entirely on on-device AI processing, a notoriously difficult feat for mobile platforms, especially for languages with fewer readily available training datasets and pre-trained models.
The core requirements were clear: real-time voice recognition, accurate intent matching (identifying the contact to call), and seamless integration with the Android dialer API. The offline constraint immediately ruled out cloud-based ASR (Automatic Speech Recognition) services, pushing the project into the realm of mobile machine learning runtimes and embedded AI models.
Initial Forays: Whisper and Frame-Size Crashes
Sarkar's initial exploration led him to explore popular ASR models. The first candidate was OpenAI's Whisper. While Whisper is known for its robust performance across many languages, including Bengali, deploying it on a mobile device proved problematic. The model, even in its smaller variants, is relatively large and computationally intensive. Running it directly on an Android CPU, without specialized hardware acceleration, resulted in significant performance issues.
A major hurdle encountered early on was managing audio input and processing. The frame size of audio chunks fed into the model became a critical parameter. Incorrect frame sizes led to crashes and corrupted audio streams, effectively halting progress. Debugging these low-level audio processing issues on Android, especially within the context of a machine learning model, is a time-consuming and intricate process. It requires a deep understanding of both Android's audio APIs and the specific requirements of the ASR model.

The Sherpa-ONNX Pivot and Zipformer's Promise
Frustrated by the limitations of directly porting Whisper, Sarkar began searching for more mobile-optimized solutions. This search led him to Sherpa-ONNX, an open-source, real-time speech recognition toolkit designed for edge devices. Sherpa-ONNX offers pre-trained models and a runtime optimized for ONNX (Open Neural Network Exchange) format, which is more amenable to deployment on diverse hardware, including mobile CPUs.
Sherpa-ONNX provided a more manageable framework. However, it still required finding a suitable acoustic model that performed well for Bengali. The initial models available through Sherpa-ONNX might not have offered the desired accuracy or speed for this specific use case. The journey involved experimenting with different acoustic models, fine-tuning parameters, and evaluating their performance in real-time scenarios.
The breakthrough came with the exploration of the Zipformer architecture. Zipformer models, often used within frameworks like K2 or NeMo, are known for their efficiency and accuracy in speech recognition tasks, particularly for streaming applications where audio is processed as it arrives. By integrating a Zipformer-based model with Sherpa-ONNX, Sarkar was able to achieve a significant improvement in both recognition accuracy and real-time performance on the Android CPU.
Navigating Android's Scoped Storage and Permissions
Beyond the AI model challenges, the project also had to contend with Android's evolving platform restrictions. Specifically, Android's scoped storage policies, introduced to enhance user privacy and security, posed a significant obstacle. Applications are no longer granted broad access to external storage. Instead, they are restricted to their own app-specific directories or require explicit user permission for accessing broader storage areas.
For a voice dialer, this wasn't a direct storage access issue but rather related to how the app might need to manage its models, temporary audio files, or contact data if not handled carefully. More critically, initiating phone calls requires specific permissions. Ensuring the app correctly requested and handled the `CALL_PHONE` permission, and that this permission was respected by the Android OS, was a crucial step. The system's handling of background processes and audio recording also needed careful management to ensure the dialer could function reliably without being terminated by the OS.
The Final Implementation and Results
The final working version of the app utilized Sherpa-ONNX with a Zipformer acoustic model. This combination allowed for a small, efficient, and accurate on-device ASR system capable of processing Bengali speech in real-time. The developer implemented a contact mapping system, likely using a local SQLite database or simple file storage, to link Bengali nicknames and commands to actual phone numbers from the user's contact list.
The app successfully demonstrated the ability to take a spoken Bengali command, transcribe it using the on-device model, identify the intended contact, and initiate a phone call via the Android dialer API. The entire process was offline, ensuring privacy and usability for the target user. The success of this project highlights the growing viability of on-device AI for low-resource languages, even on standard mobile hardware.
What remains an open question is the scalability of this approach. While successful for a single user and a limited set of contacts, scaling this to support a broader range of Bengali dialects, accents, and a vast contact list efficiently on diverse Android devices is the next frontier. The developer's honest post-mortem serves as a valuable guide for anyone tackling similar on-device AI projects, particularly those targeting underserved languages.
