← All models

audio-classification Β· audio Β· WASM Β· ~95 MB

Speech Emotion Recognition β€” hear the feeling, not the words

Two people can say "I'm fine" and mean opposite things. This model listens to how something is said β€” the acoustics of the voice, not the transcript β€” and names the emotion: angry, happy, sad, fearful, disgust, or neutral. It's a wav2vec2 network that reads the raw waveform, running entirely on your device.

At a glance

Modelonnx-community/wav2vec2-base-Speech_Emotion_Recognition-ONNX
Task / pipelineaudio-classification
Architecturewav2vec2-base with a sequence-classification head (Wav2Vec2ForSequenceClassification) β€” reads the raw 16 kHz waveform, no spectrogram step
Classes6 emotions: ANGRY, DISGUST, FEAR, HAPPY, NEUTRAL, SAD
Input16 kHz mono Float32Array, mean/variance normalised
Quantizationq8 (8-bit) ONNX
BackendWebAssembly (runs anywhere; WebGPU used when an adapter exists)
Download~95 MB, cached after first load
LicenseApache-2.0 (wav2vec2 base)
Web APIsWebAssembly, Web Workers, Web Audio, MediaRecorder, Canvas β€” all Baseline widely available

An honest caveat: emotion models learn from acted emotional speech. They pick up real acoustic cues (pitch, energy, tremor), but they are not a lie detector and real neutral speech can get surprising labels. Read the confidence bars, not just the top label β€” and treat this as a signal, not a verdict.

Run it

Pick a sample, drop an audio clip, or record yourself saying the same sentence in different tones, then hit Read emotion.

Drop an audio file here, or click to choose

See inside

The model outputs a probability for every emotion class β€” a distribution, not a single answer. When the top two are close, the voice is ambiguous (or between emotions). Below are the raw class probabilities from your clip, and the waveform the network actually read (wav2vec2 works on the raw signal β€” there's no spectrogram in between).

Read a clip to see its full emotion distribution.

Why it matters

Tone carries meaning that transcripts throw away. Detecting it on-device means an app can react to how a user sounds without shipping their voice to a server β€” private by construction.

Use cases

Basics

Read the emotion in a clip and see the full confidence distribution.

Practical

A call/feedback triage board β€” classify several clips and surface the ones that sound upset.

Wild

Emotion over time β€” slide a window across a clip and watch the feeling change.

Multi-model

Whisper transcript + voice emotion side by side: what was said vs how it sounded.

How the API works

Classification is one call with Transformers.js. Feed a 16 kHz mono Float32Array:

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

const classify = await pipeline(
  "audio-classification",
  "onnx-community/wav2vec2-base-Speech_Emotion_Recognition-ONNX",
  { dtype: "q8" },              // downloads + caches ~95 MB once
);

const output = await classify(audio, { top_k: 6 });
// audio = Float32Array @ 16 kHz mono (decode with the Web Audio API)
// β†’ [{ label: "ANGRY", score: 0.62 }, { label: "NEUTRAL", score: 0.15 }, … ]

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 renders the full probability distribution β€” not just the winner.

References