automatic-speech-recognition Β· audio Β· WASM (WebGPU when available) Β· ~65 MB
Moonshine listens to audio and writes down what was said β like Whisper, but built for speed at the edge. It doesn't pad every clip to 30 seconds, so a short utterance transcribes in a fraction of its own length. Record from the mic, drop a file, or use a sample, and watch the real-time factor.
| Model | onnx-community/moonshine-base-ONNX (Useful Sensors Moonshine, base) |
|---|---|
| Task / pipeline | automatic-speech-recognition |
| Architecture | Encoder-decoder transformer (~61M params) trained for short-form, low-latency ASR; input scales with audio length instead of padding to a fixed 30 s window |
| Quantization | q8 (8-bit) ONNX β the *_quantized.onnx weights |
| Backend | WebAssembly (WebGPU when a real adapter is present), honest fallback |
| Download | ~65 MB (encoder + merged decoder), cached after first load |
| License | MIT (Useful Sensors Moonshine) |
| Web APIs | WebAssembly / WebGPU, Web Workers, Web Audio (decode + resample), MediaRecorder (mic) |
Choose audio β record from your mic, upload a file, or pick a sample. The page decodes it to 16 kHz mono (what Moonshine expects), draws the waveform, and transcribes it in a Web Worker. The headline number is speed: how much faster than real time it ran.
The bundled JFK speech clip alone is an inaugural excerpt (20 January 1961), spoken by John F. Kennedy β public domain, U.S. government work Β· JFK audio source and attribution record.
This context didn't grant mic access (common in headless / embedded views). Moonshine still works β use a sample above or Upload audio. For live recording, open this in a normal browser tab and allow the microphone when prompted.
The interesting number for Moonshine isn't just the text β it's how fast it got there. Below is the real-time factor (process time Γ· audio length) and the derived speed-up. Whisper pads short clips to a fixed 30 s window; Moonshine's compute scales with the actual audio, so short utterances finish much sooner. Everything here is measured on this device.
On-device transcription used to force a trade-off: Whisper is accurate but pads and chunks, which adds latency on short inputs. Moonshine is tuned for the interactive case β voice commands, live dictation, short replies β where a snappy response matters more than transcribing an hour of audio. It's a free, private, offline capability of your page.
One clip in, a transcript out β with the speed readout front and centre.
Fast voice commands: speak a phrase, match it to an action, instantly.
Real-time streaming captions: transcribe the mic in a rolling loop.
Speak β Moonshine β an LLM answers your spoken question.
Transcription is one pipeline call β Moonshine uses the standard ASR task:
import { pipeline } from "@huggingface/transformers";
const transcribe = await pipeline(
"automatic-speech-recognition",
"onnx-community/moonshine-base-ONNX",
{ device: "wasm", dtype: "q8" }, // WebGPU when a real adapter exists
);
// audio = a 16 kHz mono Float32Array (decode with Web Audio, then resample)
const out = await transcribe(audio);
// out.text β the transcript
// Moonshine has no timestamp tokens β it's built for fast short-form transcription.
This page decodes the mic/file/sample to 16 kHz mono with the Web Audio API on the main thread, then transfers just the Float32 samples to a Web Worker where the pipeline runs β so the model never blocks the interface. It times the call and divides by the clip length to show a real real-time factor.