โ† All models

audio-classification ยท audio ยท spoken language ID ยท WASM ยท ~974 MB

Spoken language identification โ€” name the language you hear

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.

At a glance

ModelXenova/mms-lid-126
Task / pipelineaudio-classification
ArchitectureWav2Vec2 (MMS / XLS-R, ~1B params) with a 126-way language head โ€” reasons over the RAW waveform, no spectrogram
Classes126 spoken languages (ISO-639-3 codes: eng, spa, cmn, hin, ara, โ€ฆ)
Input16 kHz mono audio (a few seconds is plenty)
Quantizationq8 (8-bit) ONNX
BackendWebAssembly (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.
LicenseCC-BY-NC-4.0 (Meta MMS) โ€” research/showcase use
PrivacyAll inference is local; the audio never leaves your device.
Web APIsWebAssembly, Web Workers, Web Audio, MediaRecorder, Canvas โ€” all Baseline widely available

Run it

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.

Drop an audio file here, or click to choose

See inside

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).

Identify a clip to see the full distribution.

Why it matters

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.

Use cases

Basics

Identify a sample clip's language and read the top guesses โ€” feel what the model does.

Practical

A language router: detect first, then show which ASR / translator you'd hand the audio to.

Wild

Short & code-switched clips: trim the audio and watch confidence and the runners-up shift.

Multi-model

Detect the language, then transcribe it with the matching Whisper model โ€” a two-model pipeline.

How the API works

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.

References

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.