audio-feature-extraction Β· audio Β· WASM (WebGPU when available) Β· ~95 MB
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.
| Model | Xenova/wavlm-base-plus (microsoft/wavlm-base-plus) |
|---|---|
| Task / pipeline | audio-feature-extraction β loaded as AutoModel so we can read the raw last_hidden_state frames |
| Architecture | Self-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. |
| Output | last_hidden_state β shape [1, T, 768]: one 768-dim vector per ~20 ms frame |
| Quantization | q8 (8-bit) ONNX β onnx/model_quantized.onnx |
| Backend | WebAssembly (WebGPU when a real adapter is present), honest fallback |
| Download | ~95 MB (single encoder), cached after first load |
| License | MIT β Microsoft WavLM (UniLM project) |
| Web APIs | WebAssembly / WebGPU, Web Workers, Web Audio (decode + resample to 16 kHz) |
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 pooled embedding (768-dim, down-sampled to 64 bars):
Clip B pooled embedding:
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.
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.
Audio similarity: embed a bank of clips and read the full pairwise cosine matrix.
Find a sound: brush a query on a recording and search for where it recurs.
Cluster by ear: project every clip's embedding to 2D and watch voices group.
WavLM retrieves the nearest clip by sound β wav2vec2 reads out what it says.
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.
Sample clips: JFK inaugural (public domain) + TED excerpt, and Spanish/German/Russian Spoken-Wikipedia excerpts (CC BY-SA) β see the model page credits.