← All models

audio-feature-extraction Β· audio Β· WASM (WebGPU when available) Β· ~95 MB

WavLM β€” turning speech into features, not text

Every other speech model here hands you words. WavLM hands you numbers. It's a self-supervised speech model: for every ~20 ms frame of audio it emits a 768-dimensional embedding β€” a learned description of what the sound is, with no transcript and no labels. Those embeddings let you compare two clips, search a recording for a sound, and cluster audio by ear β€” entirely on this device.

At a glance

ModelXenova/wavlm-base-plus (microsoft/wavlm-base-plus)
Task / pipelineaudio-feature-extraction β€” loaded as AutoModel so we can read the raw last_hidden_state frames
ArchitectureSelf-supervised speech transformer: a CNN feature encoder over raw 16 kHz audio β†’ a 12-layer transformer with a gated relative-position bias. Pretrained with masked speech prediction + denoising (it learns to model speech even under simulated overlap/noise). ~94.7M params. No text head β€” the output is per-frame embeddings.
Outputlast_hidden_state β€” shape [1, T, 768]: one 768-dim vector per ~20 ms frame
Quantizationq8 (8-bit) ONNX β€” onnx/model_quantized.onnx
BackendWebAssembly (WebGPU when a real adapter is present), honest fallback
Download~95 MB (single encoder), cached after first load
LicenseMIT β€” Microsoft WavLM (UniLM project)
Web APIsWebAssembly / WebGPU, Web Workers, Web Audio (decode + resample to 16 kHz)

Run it β€” how alike are two sounds?

Pick a clip for A and one for B (or upload your own), then Compare. Each clip is embedded on-device into a single 768-dim vector; their cosine similarity says how close they are in WavLM's feature space. Same speaker or same words score high; different voices/content score lower.

Clip A

Clip B

See inside β€” the frame embeddings

This is what WavLM actually produces. Below is clip A's last_hidden_state painted as a heatmap: time runs left→right (one column per ~20 ms frame), the 768 embedding dimensions run top→bottom, and colour is each value (dark = low, bright = high). There's no vocabulary here — just structure. Silence looks flat; a spoken word lights up a characteristic vertical texture. The single vector we compare is this whole map averaged over time.

Compare two clips above to paint clip A's frame-embedding heatmap.

Why it matters

A transcript throws almost everything away β€” who spoke, how, in what language, over what noise. WavLM's self-supervised embeddings keep it. Because they were learned by predicting masked speech (even under simulated overlap and noise), a single 768-dim vector captures speaker, phonetic content and acoustic conditions at once β€” and you can do maths on it without any labelled training data of your own.

Use cases

Basics

Audio similarity: embed a bank of clips and read the full pairwise cosine matrix.

Practical

Find a sound: brush a query on a recording and search for where it recurs.

Wild

Cluster by ear: project every clip's embedding to 2D and watch voices group.

Multi-model

WavLM retrieves the nearest clip by sound β†’ wav2vec2 reads out what it says.

How the API works

There's no pipeline for "give me the frames" β€” so we load the model directly and read last_hidden_state, then mean-pool + L2-normalise into one comparable vector:

import { AutoProcessor, AutoModel } from "@huggingface/transformers";

const processor = await AutoProcessor.from_pretrained("Xenova/wavlm-base-plus");
const model = await AutoModel.from_pretrained(
  "Xenova/wavlm-base-plus",
  { device: "wasm", dtype: "q8" },
);

// audio = 16 kHz mono Float32Array
const inputs = await processor(audio);
const { last_hidden_state } = await model(inputs); // [1, frames, 768]

// one comparable vector per clip: average over time, then normalise
const emb = meanPool(last_hidden_state);           // 768-dim
const score = cosine(embA, embB);                  // -1 … 1

Inference and the heatmap composite both run in a Web Worker, and the RGBA heatmap is transferred back (not copied) so the UI never janks β€” nothing is faked or pre-computed.

References

Sample clips: JFK inaugural (public domain) + TED excerpt, and Spanish/German/Russian Spoken-Wikipedia excerpts (CC BY-SA) β€” see the model page credits.