← All models

automatic-speech-recognition Β· audio Β· WASM (WebGPU when available) Β· ~65 MB

Moonshine β€” fast, low-latency speech-to-text

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.

At a glance

Modelonnx-community/moonshine-base-ONNX (Useful Sensors Moonshine, base)
Task / pipelineautomatic-speech-recognition
ArchitectureEncoder-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
Quantizationq8 (8-bit) ONNX β€” the *_quantized.onnx weights
BackendWebAssembly (WebGPU when a real adapter is present), honest fallback
Download~65 MB (encoder + merged decoder), cached after first load
LicenseMIT (Useful Sensors Moonshine)
Web APIsWebAssembly / WebGPU, Web Workers, Web Audio (decode + resample), MediaRecorder (mic)

Run it

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.

or a sample:

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.

JFK β€” inaugural (11s)

Transcript

Transcribe a clip to see the text here.

See inside

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.

Transcribe a clip to see its speed profile.

Why it matters

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.

Use cases

Basics

One clip in, a transcript out β€” with the speed readout front and centre.

Practical

Fast voice commands: speak a phrase, match it to an action, instantly.

Wild

Real-time streaming captions: transcribe the mic in a rolling loop.

Multi-model

Speak β†’ Moonshine β†’ an LLM answers your spoken question.

How the API works

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.

References