audio-classification ยท audio ยท spoken language ID ยท WASM ยท ~974 MB
Give it speech and it tells you the language โ one of 126 โ not the words. Meta's MMS-LID listens to the raw waveform on a billion- parameter Wav2Vec2 backbone and returns a language with a confidence score. It's the audio-first cousin of the text language detector: that one reads, this one listens โ the router step before any speech pipeline.
| Model | Xenova/mms-lid-126 |
|---|---|
| Task / pipeline | audio-classification |
| Architecture | Wav2Vec2 (MMS / XLS-R, ~1B params) with a 126-way language head โ reasons over the RAW waveform, no spectrogram |
| Classes | 126 spoken languages (ISO-639-3 codes: eng, spa, cmn, hin, ara, โฆ) |
| Input | 16 kHz mono audio (a few seconds is plenty) |
| Quantization | q8 (8-bit) ONNX |
| Backend | WebAssembly (runs anywhere; no WebGPU needed) |
| Download | ~974 MB โ a large one-time download (the backbone is a 1B-param model), cached after first load. Best on desktop / good Wi-Fi. |
| License | CC-BY-NC-4.0 (Meta MMS) โ research/showcase use |
| Privacy | All inference is local; the audio never leaves your device. |
| Web APIs | WebAssembly, Web Workers, Web Audio, MediaRecorder, Canvas โ all Baseline widely available |
Pick a language sample, drop an audio file, or record yourself speaking anything โ then identify. The bars are the model's top languages, most confident first.
The model outputs one score per language โ a softmax over all 126. Two numbers describe the shape of that distribution: the top-1 margin (how far the winner leads the runner-up) and the normalised entropy (0 = certain, 1 = torn). A few seconds of clear speech is peaky and low-entropy; a very short, noisy, or code-switched clip spreads the mass across related languages โ watch the runners-up, they're usually neighbours in the same family (Spanish โ Galician, Dutch โ Afrikaans).
| # | Language | code | score |
|---|
Confidence (uncertain โ โ certain):
Almost every speech feature has a hidden first question: what language is this? Pick the wrong transcriber or translator and everything downstream is garbage. Answering that on-device, before any upload, makes multilingual audio pipelines both cheaper and more private.
Identify a sample clip's language and read the top guesses โ feel what the model does.
A language router: detect first, then show which ASR / translator you'd hand the audio to.
Short & code-switched clips: trim the audio and watch confidence and the runners-up shift.
Detect the language, then transcribe it with the matching Whisper model โ a two-model pipeline.
Identification is one call with Transformers.js. Feed a 16 kHz mono Float32Array:
import { pipeline } from "@huggingface/transformers";
const identify = await pipeline(
"audio-classification",
"Xenova/mms-lid-126",
{ dtype: "q8" }, // large one-time download (~974 MB), then cached
);
const output = await identify(audio, { top_k: 5 });
// audio = Float32Array @ 16 kHz mono (decode with the Web Audio API)
// โ [{ label: "eng", score: 0.94 }, { label: "haw", score: 0.01 }, โฆ ]
// labels are ISO-639-3 codes; map them to names for display.
This page decodes files / mic recordings to 16 kHz mono with an OfflineAudioContext,
runs the pipeline inside a Web Worker so the UI never janks, and requests top_k: 126
so "See inside" can show the whole language distribution โ not just the winner.
Sample clips are ~10s excerpts of volunteer "Spoken Wikipedia" recordings from Wikimedia Commons (CC BY-SA); the English clip is a public-domain JFK excerpt. See CREDITS.md for per-clip attribution.