audio-classification · 12-layer Wav2Vec2-Base · SUPERB IEMOCAP 4 classes · WASM q4 · 89.9 MB · Apache-2.0

Wav2Vec2-Base SUPERB ER: 4-Class IEMOCAP Vocal Affect Meter

Self-supervised Wav2Vec2-Base fine-tuned on the SUPERB Emotion Recognition benchmark (superb/wav2vec2-base-superb-er, Apache-2.0) reads raw 16 kHz mono waveforms with a learned 13-layer weighted sum and classifies vocal affect into 4 IEMOCAP classes — neu (Neutral), hap (Happy), ang (Angry), and sad (Sad) — entirely on your device.

At a glance

Wav2Vec2-Base SUPERB Emotion Recognition model specifications and browser contract
Upstream checkpoint superb/wav2vec2-base-superb-er (apache-2.0 · 94.6M params · 7-layer CNN + 12 Transformer layers, 12 heads, hidden_size: 768, use_weighted_layer_sum: true → classifier_proj_size: 256)
Browser ONNX artifact onnx-community/wav2vec2-base-superb-er-ONNX (q4 · 89.86 MB = 89,863,840 B total: onnx/model_q4.onnx + configs · apache-2.0)
Task & runtime audio-classification · shared @huggingface/transformers@3.7.5 via lib/webai.js · CPU wasm
4 IEMOCAP classes 0: neu (Neutral), 1: hap (Happy), 2: ang (Angry), 3: sad (Sad) · 16 kHz mono Float32Array PCM (do_normalize: false, return_attention_mask: true)
Web APIs WebAssembly, Module Web Workers, Web Audio / OfflineAudioContext, MediaRecorder (optional mic), Canvas 2D — all Baseline widely available

Distinct from sibling built Wav2Vec2 audio models: Unlike speech-emotion-recognition (onnx-community/wav2vec2-base-Speech_Emotion_Recognition-ONNX, 6 classes SAD/ANGRY/DISGUST/FEAR/HAPPY/NEUTRAL — distinct from 8-class RAVDESS — using last-layer pooling and do_normalize: true) and unlike wav2vec2-base-superb-ks (same SUPERB weighted-layer-sum backbone fine-tuned on 12-class Google Speech Commands keyword spotting), wav2vec2-base-superb-er implements the canonical S3PRL SUPERB IEMOCAP 4-class Emotion Recognition head (neu, hap, ang, sad) with use_weighted_layer_sum: true and unnormalized 16 kHz waveforms (do_normalize: false).

Honest interpretation note: IEMOCAP consists of scripted and improvised acted dyadic English speech. High-energy rhetorical delivery (such as public speeches) can score strongly as ang or hap; read the full 4-class probability distribution and entropy as an acoustic prosody signal, never as a clinical diagnosis or lie detector.

1 · 4-Class IEMOCAP Vocal Affect Meter

Reused ledgered audio (zero duplicate WAV assets): JFK inaugural address (20 Jan 1961, public domain, via models/speech-emotion-recognition/speech-sample.wav) and LibriSpeech test-clean 61-70968-0000 (Paul-Gabriel Wiener, CC BY 4.0 · credits), plus deterministic in-memory JS PCM prosody probes, local file upload, and optional live microphone capture.

Initialise Wav2Vec2-Base SUPERB ER (89.86 MB q4 WASM) above to classify 4-class IEMOCAP vocal affect locally.

Loading sample…

Live 4-class SUPERB IEMOCAP affect meter

Ranked probability distribution

Run classification above to inspect all 4 SUPERB IEMOCAP probabilities.

Top affect–
Top probability–
Margin (1st–2nd)–
Entropy (max 2.0b)–
Latency · RTF–
Runtime · NaN check–

2 · See inside: 20 ms CNN frame envelope & acoustic telemetry

Wav2Vec2's 7-layer 1D CNN feature encoder ingests raw 16 kHz samples using a 25 ms receptive field (400 samples) and a 20 ms stride (320 samples → 50 frames/s). Because do_normalize: false is active in SUPERB ER's feature extractor, raw amplitude, crest factor, and voicing cadence feed directly into the 12 Transformer blocks before S3PRL's learned weighted layer sum mean-pools over time.

CNN frames (20 ms)–
RMS · Peak (dBFS)–
Crest factor–
High-arousal (ang+hap)–

Why Wav2Vec2-Base SUPERB ER matters

Voice prosody conveys urgency, enthusiasm, and frustration that plain text transcripts erase. Running the standard 4-class SUPERB IEMOCAP benchmark checkpoint in 89.86 MB q4 WASM keeps sensitive call audio, voice notes, and coaching takes strictly on-device with zero cloud egress.

3 · Use-case ladder

4 · How the API works

import { pipeline } from "@huggingface/transformers@3.7.5";

const classifier = await pipeline(
  "audio-classification",
  "onnx-community/wav2vec2-base-superb-er-ONNX",
  { device: "wasm", dtype: "q4" },
);

const scores = await classifier(pcm16k, { top_k: 4 });
// → [{ label: "ang", score: 0.859 }, { label: "hap", score: 0.070 }, ...]

5 · Inspect worker, WAV decoder & mic code

Show the code · worker.js — ensureLoaded() (epoch-guarded Transformers.js 3.7.5 q4 pipeline)
Show the code · er-core.mjs — parseWavToMono16k() (multi-bit-depth WAV parser)
Show the code · er.js — createMicRecorder() (user-initiated mic capture & cleanup)