whiskers.git / tools / fetch-speech-model.sh
1#!/usr/bin/env bash

Fetch the Vosk small English model the app falls back on when the tablet has no speech recogniser (Fire OS has no Google services). Idempotent; verifies the hash.

nix develop ~/whiskers#android -c tools/fetch-speech-model.sh

vosk-model-small-en-us-0.15 (Apache-2.0), https://alphacephei.com/vosk/models, 41,205,931 bytes. The hash is what was downloaded on 2026-10-04; the vendor publishes none.

9set -euo pipefail
10cd "$(dirname "$0")/.."
11dest=android/app/src/main/assets/model-en-us
12[ -f "$dest/am/final.mdl" ] && exit 0
13sha=30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498
14tmp=$(mktemp -d)
15trap 'rm -rf "$tmp"' EXIT
16curl -sSL -o "$tmp/m.zip" https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip
17echo "$sha  $tmp/m.zip" | sha256sum -c - >&2
18unzip -q "$tmp/m.zip" -d "$tmp"
19mkdir -p "$dest"
20cp -r "$tmp"/vosk-model-small-en-us-0.15/. "$dest"/