At a glance
| Model | onnx-community/Musical-genres-Classification-Hubert-V1-ONNX (ONNX build of SeyedAli/Musical-genres-Classification-Hubert-V1) |
|---|---|
| Task / pipeline | audio-classification |
| Genres | 10 (GTZAN): blues, classical, country, disco, hip-hop, jazz, metal, pop, reggae, rock |
| Architecture | DistilHuBERT (base ntu-spml/distilhubert) fine-tuned for genre |
| Quantization | q8 (8-bit) ONNX |
| Backend | WebAssembly (runs anywhere; no WebGPU needed) |
| Input | 16 kHz mono audio (decoded/resampled in the browser) |
| Download | ~24 MB, cached after first load |
| License | Apache-2.0 (base model → DistilHuBERT, both Apache-2.0) |
Run it
Drop or choose an audio file, record a clip, or try a built-in sample. The clip is decoded to 16 kHz mono in the browser and classified locally.
Drag & drop an audio file here, or:
Use-case ladder
Basics · 10-Genre Probability, Waveform & Sliding-Window Timeline Inspector
Audition bundled WAVs, deterministic synthesized genre loops, or local files; inspect RMS/centroid descriptors, entropy, top-1/top-2 margin, and slice-by-slice temporal genre stability — with Show the code synced to worker.js.
Practical · Batch Music Library & Playlist Auto-Tagger
Classify multi-track demo crates or uploaded audio files on-device with live confidence thresholds, review flags, inline playback preview, and snapshot-aligned .m3u8, formula-safe .csv, and .json library exports.
Wild · Live Audio Perturbation & Genre-Morphing Stress Lab
Dial real-time DSP transforms — varispeed tempo/pitch shift (0.7×–1.4×), low-pass/high-pass filters, metal overdrive saturation, bitcrush, and vinyl noise — and plot exact before-vs-after probability shifts across all 10 genres.
Multi-model · Neural Audio Codec Resilience Bench (SNAC 24kHz → Music Genre)
Compress tracks ~380× to ~0.99 kbps discrete audio tokens through SNAC 24kHz (~80.3 MB) and re-classify with DistilHuBERT (~24 MB) in isolated workers to measure whether musical genre survives extreme neural compression.
Why it matters
Genre is the classic music-understanding task — the model learns what disco or metal sounds like from the raw waveform, no tags or filenames. Doing it in the browser means a library of audio can be organised or filtered without uploading a single track.
- Auto-tagging — label a personal music library or a sample pack by genre, on-device.
- Playlisting & discovery — group tracks by feel, or seed a "more like this" queue.
- Creative tools — a DAW plugin that suggests a genre for a loop as you record it.
- Moderation / routing — sort user-uploaded audio by genre before it hits a server.
It's a best-effort classifier trained on the small GTZAN set: it's strongest on clear, full productions and can be swayed by a track's dominant texture — a chord progression reads as jazz, a drum-heavy loop as hip-hop — and non-music audio (speech) just gets the nearest-looking genre. The built-in samples are short procedural clips (a chord progression, a drum beat); upload a real song for the full ten-genre range.
How the API works
Genre classification is one pipeline call on a 16 kHz mono waveform:
import { pipeline } from "@huggingface/transformers";
const classify = await pipeline("audio-classification",
"onnx-community/Musical-genres-Classification-Hubert-V1-ONNX");
const out = await classify(audioFloat32, { top_k: 10 });
// → [{ label: "classical", score: 0.97 }, { label: "jazz", score: 0.01 }, … ]
The browser decodes/resamples the file to 16 kHz mono; the DistilHuBERT model turns the waveform into features and scores the ten genres. It all runs in a Web Worker so the UI stays responsive.