browser-speech-to-text-skilllisted
Install: claude install-skill 4ntiDandruff/zero-bloat-skills
# Browser Speech-to-Text (STT) Skill
Zero-server-cost, near-zero latency Speech-to-Text architecture using native browser APIs (`SpeechRecognition`). Completely eliminates the CPU, RAM, and GPU hosting overhead of Whisper or cloud speech APIs for mobile web applications.
Battle-tested in the **Kas Megapass** daily bookkeeping platform (`kas.megapass.web.id`).
---
## 1. Architectural Principles
* **0 MB Server RAM**: Processing happens on the client browser / OS speech engine. The server receives only lightweight normalized text payloads.
* **Instant Start (<100ms)**: Eliminates file buffering, audio encoding/decoding, and multi-megabyte audio uploads over cellular connections.
* **Native Indonesian Acoustic Model (`id-ID`)**: Built-in system recognition handles local accents and dialects natively.
* **Graceful Degradation**: Seamless fallback to standard text input when mic permissions are blocked or browser lacks API support.
---
## 2. Client-Side Web Speech Implementation
### The Android PWA Permission Trap
On Android PWAs, calling `SpeechRecognition.start()` directly often fails silently with a `not-allowed` error. The bulletproof workaround is to trigger a lightweight `navigator.mediaDevices.getUserMedia({ audio: true })` call first to open the native OS permission prompt, immediately release the audio track, and then start `SpeechRecognition`:
```javascript
// static/js/voice-input.js
(function() {
var activeRec = null;
function micSupported() {
return