Naming a sound
Drop a file into the playground and it says in a word what the sound is: speech, music, birdsong, a clarinet, silence. A level, two trained networks and a rule choose that word. How they choose it, what it costs, and where it is wrong.
01One word
The playground names what it is given: of this site's blackbird it says birdsong. (On the home page, where the blackbird plays, the page says that word of its own sound; of any other, the listeners below do.) The word is one of four kinds: silence; speech, music, or speech and music; a name from a list of 127, such as clarinet, rain or telephone; or no word at all.
Here are nine sounds this page holds or makes, and what the playground calls each.
Three listeners stand in line. A level comes first and can only say silence. Then a network trained to tell speech from music. Where it has no word, a second network that scores 521 kinds of sound, and a rule that turns its scores into a word.
Of these nine, the level names one, the first network five, the second three. Two of those three are wrong: a 440 Hz tone is called a telephone, and white noise a waterfall. A voice made of three vowels, with no words in it, is called speech.
02Silence by level
If no sample reaches −70 dBFS, 0.000316 of full scale, the sound is silence, and neither network is asked. It is the cheapest test, and it is the only way the word silence is said.
The second network has a class called Silence, and it is not used. It gives that class to recordings that are quiet but not silent. DEMAND's recordings of places,9 at −37 to −56 dBFS RMS, score Silence 0.91 to 1.00: a park, a field, a hallway, a room with a washing machine running. A river bank scores 0.50. Said, every one of those would be wrong, so a quiet place gets no word.
03Speech or music
The first listener is the speech, music and noise network of inaSpeechSegmenter,5 made at Ina, France's national audiovisual institute. @audio/neural-denoise carries it to keep its denoisers off music, and from version 0.7 gives its reading as segments():7 782,403 weights, 1.56 MB as float16, inside the package.
It hears the sound at 16 kHz as 24 mel bands, keeps the lowest 21, and judges patches of 0.68 s, one every 100 ms, each scaled by its own mean and deviation so that loudness does not count. A Viterbi pass over the whole input joins the patches into segments. Changing kind costs so much there that a segment lasts a second or more.
import { segments } from '@audio/neural-denoise'
await segments(pcm, 44100)
// [{ kind: 'speech', start: 0, end: 8.1 }, { kind: 'music', start: 8.1, end: 12.9 }, { kind: 'noise', start: 12.9, end: 26 }]
The playground gives it a sound in parts of 10 s at most and adds up how long each kind holds over them. Where speech and music each hold a quarter or more, it says speech and music. Otherwise it says speech where speech holds at least as much as music and as much as noise, and music where music holds at least as much as noise. Noise is never said: to this network, noise is whatever is neither, a blackbird and a door alike. The programme holds speech 31%, music 19%, noise 50%, and gets no word from it.
On the package's labelled test sets it names speech as speech and songs as music almost without fail. A voice singing alone falls between the two. Noise alone it takes for speech or music about one frame in five, which is why its word for noise is not used.
| Test set: the share of its active 10 ms frames named each kind7 | Speech | Music | Noise |
|---|---|---|---|
| VoiceBank+DEMAND speech, clean / noisy, 824 files each | 99.9 / 99.8% | 0.0 / 0.0% | 0.1 / 0.2% |
| The same speech over a music bed 10 dB down, 275 | 98.6% | 1.4% | 0.0% |
| MUSDB18 test previews, songs, 50 | 0.0% | 100% | 0.0% |
| VocalSet sung phrases, 20 | 26.8% | 66.4% | 6.8% |
| MUSDB18 vocal stems alone, 50 | 38.1% | 57.5% | 4.4% |
| DEMAND noise alone, 824 | 13.6% | 7.8% | 78.6% |
Before networks this was done with rules. Scheirer and Slaney6 tried 13 features on FM radio, among them energy modulated at 4 Hz (the rate of syllables), the share of quiet frames, the spectrum's centroid, rolloff and flux, and zero crossings. Their best classifier got 5.8% of frames wrong, and 1.4% of 2.4 s segments. Split three ways, speech, music, or both at once, it was about 65% right, and they doubted the features could tell one genre from another. Rules need no download. They cannot name a blackbird.
04Everything else
Where the first listener has no word, the second is asked: YAMNet, by Manoj Plakal and Dan Ellis at Google,2 a MobileNet v14 trained on AudioSet,1 2,084,320 ten-second clips from YouTube labelled by people. Of AudioSet's classes it predicts 521.
It hears 0.96 s at a time, a patch every 0.48 s, as 64 mel bands from 125 to 7,500 Hz, and scores every class on each patch independently, so a patch can be Speech and Music at once. It has 3.7 million weights and makes 69.2 million multiplications a patch. @audio/neural-tag computes its input in JavaScript as Google's features.py does and runs the network through ONNX Runtime.8 Its file, 7,495,175 bytes, keeps the larger weights in float16. On 49 patches its scores differ from Google's Keras model by 3.6 × 10−3 at most, and the best class is the same in all 49. tag() ranks the classes by their mean over the patches.
Google gives its accuracy over the 521 classes on AudioSet's evaluation set: a balanced mean average precision of 0.306.2 Its model card warns that "YAMNet's classifier outputs have not been calibrated across classes, so you cannot directly treat the outputs as probabilities."3 A Clarinet of 0.6 and a Bird of 0.6 need not be equally sure.
05A word from the scores
The rule, called(), knows 132 of the 521 classes and gives them 127 words. 123 classes are particular, their words such as birdsong, clarinet, rain, typing; nine are general: speech, music, animal, birds, insects, water, vehicle, engine, noise. It says the best particular class whose mean score is 0.5 or more, else the best general one, else nothing.
The bar is high because the scores are not calibrated. It was set by reading about thirty files, the EBU's instrument excerpts and this site's blackbird among them. It is not fitted to a labelled set, and how often it is right on other sounds is not measured.
No family of instruments is said, though YAMNet has classes for them (brass, woodwind, bowed, plucked, mallet). It has no class for a bassoon, and scores one Brass instrument 0.58; none for a celesta, and scores one Vibraphone 0.36.
Lower the bar to 0.35 and the glockenspiel is named, rightly; for the tagger alone, the bassoon becomes a french horn and the celesta a vibraphone. Raise it to 0.6 and the white noise loses its waterfall, and the trumpet its name. The first listener also hides some of the tagger's best answers: it calls the violin and the harp music, so the tagger, which would name them (0.68 and 0.61), is never asked.
06The whole of it, in code
import { segments } from '@audio/neural-denoise' // 0.7: the first listener, its weights inside
import { tag } from '@audio/neural-tag' // 0.1: YAMNet, its model fetched on first use
import { kindOf } from './kind.js' // the rule, as the playground has it
import { heard } from './listen.js' // the stretches the playground listens to
const stretches = heard(channels, 44100).map(s => s.x)
const { kind, shares, tags } = await kindOf(stretches, 44100, {
segments,
tag: (x, rate) => tag(x, rate, { top: Infinity })
})
// kind: 'silence', 'speech', 'music', 'speech and music', a word from the list, or ''
heard gives what the playground listens to: the whole sound up to a minute, in equal parts of 10 s at most, so that its worker, which also plays, is never held longer than one part takes; else six stretches of 10 s spread from its start to its end; each the mean of its channels (listen.js). Inside, kindOf returns silence if no sample of any stretch reaches −70 dBFS; otherwise asks segments of each stretch and adds up the time each kind holds; returns that word if there is one; otherwise asks tag once, of the stretches end to end, and returns what called() makes of its scores. A tagger that fails says nothing and throws nothing. kind.js beside this article is the playground's own, repl/kind.js in audiojs/audio, copied; a test holds the two the same.
07Name your own
Drop a sound on the panel, choose a file, or pick one of this page's. Nothing is fetched until you do. Then the first listener loads from jsDelivr with its weights, and, if it has no word, the tagger with ONNX Runtime and the model from Hugging Face. Both run in this page; the sound goes nowhere.
08What it costs
Bytes, fetched once and then kept by the browser, as measured in Chromium:
| What | Bytes | From | When |
|---|---|---|---|
| The first listener: its module, the resampler's and the runtime adapter's | about 48,000* | jsDelivr | the first sound |
Its weights, guard.bin | 1,564,806 | jsDelivr | the first sound |
| The tagger's module and its FFT | about 29,000* | jsDelivr | the first sound the first listener has no word for |
| ONNX Runtime Web 1.30, script and WebAssembly | 14,359,684, compressed 3,115,576 | jsDelivr | |
YAMNet, yamnet.fp16.onnx | 7,495,175 | Hugging Face |
* The two packages' own modules as built here from their 0.7.0 and 0.1.0 source, the way jsDelivr builds a package; jsDelivr's builds may differ by a few kilobytes.
Time, on an Apple M4 Max (14 cores) under macOS 26.5, running other jobs at a load average of 4 to 11. In Node 25.9 with onnxruntime-node 1.30, nothing loaded, the blackbird's 18.8 s got its word in 358 ms: 265 ms for the first listener, its weights unpacked first, and 93 ms for the tagger, its session made first. A 2 s tone after that took 28 ms.
In headless Chromium, the two packages and the model served from this machine and ONNX Runtime fetched from jsDelivr, the blackbird's first word took 2.5 s, 2.1 s of it the tagger loading and running for the first time; the second time, 0.44 s. WebKit took as long, 2.5 s and then 0.40 s. In Firefox, as Playwright runs it, the first listener was 16 times slower than in Chromium, 2.0 s for 10 s of sound against 0.12 s, resampled or not, and the blackbird's first word took 9.1 s. Why is not traced.
Per minute of audio, by their own measurements: the first listener 1.1 s of CPU per channel,7 the tagger 0.49 to 0.54 s on one thread.8 In the playground both run in its worker, off the page's thread. In this article they run on the page's own thread, so a long file holds the page still for as long as they take.
09Where it is wrong
Wrong names, said. A 440 Hz sine is a telephone (Telephone 0.99, Dial tone 0.97), and so is the playground's own test sound, the same tone (0.98). Telephone lines do play such tones: the North American dial tone is 350 and 440 Hz together.10 But the file is a test tone. White noise is a waterfall (0.58; White noise 0.26).
Right names, not said. The violin (0.68) and the harp (0.61) would be named by the tagger, and the first listener says music before it is asked. The guitar (0.23) and the piano (0.42) score under the bar either way.
No word for some. The glockenspiel scores 0.36 and gets none. Quiet places get none. A mix such as the programme gets none: the tagger hears it whole, and nothing in it reaches 0.5.
Speech that is not speech. The synthetic voice, a sawtooth through three formants singing three vowels, is speech to the first listener throughout. A voice singing alone is either: MUSDB18's vocal stems are 57.5% music and 38.1% speech to it.
Whose words. What counts as speech or music is what the first listener's training examples were labelled; its README does not say what they were. The tagger's classes are AudioSet's, labelled on YouTube clips.
The bar. 0.5, set by reading these sounds, over scores their makers say are not calibrated.
Nothing here understands a sound. One network splits time into three kinds, the other gives 521 numbers for every 0.96 s, and a rule picks a word. Read the word as a label to check.
10Other listeners
Each project's own figures, not measured alike:
| Model | Size | On AudioSet | Licence |
|---|---|---|---|
| YAMNet, here2 | 3.7M weights, 7.5 MB | balanced mAP 0.306 | Apache-2.0 |
| CED-tiny11 | 5.5M parameters, ONNX 6.7 MB | mAP 48.1 | weights Apache-2.0, code GPL-3.0 |
| PANNs, the best of them12 | mAP 0.439 | ||
| AST13 | 86.6M parameters | mAP 0.4593 | BSD-3-Clause |
| CLAP, any words as labels14 | quantized ONNX: audio 34.3 MB, text 127 MB | Apache-2.0 |
CED-tiny reports a higher score at a size close to YAMNet's; its weights and its code carry different licences, which would need settling with its authors before it is bundled. MediaPipe's Audio Classifier runs YAMNet in a browser too, as @mediapipe/tasks-audio.15
- J. F. Gemmeke, D. P. W. Ellis, D. Freedman, A. Jansen, W. Lawrence, R. C. Moore, M. Plakal, M. Ritter, “Audio Set: An ontology and human-labeled dataset for audio events,” ICASSP 2017. Counts as its page gives them.
- YAMNet, M. Plakal and D. Ellis: tensorflow/models research/audioset/yamnet at c14bf9a, its README: classes, weights, multiplications, patches, accuracy.
- YAMNet's model card, TF Hub google/yamnet/1, Limitations.
- A. G. Howard et al., “MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications,” 2017.
- D. Doukhan, J. Carrive, F. Vallet, A. Larcher, S. Meignier, “An Open-Source Speaker Gender Detection Framework for Monitoring Gender Equality,” ICASSP 2018; D. Doukhan, E. Lechapt, M. Evrard, J. Carrive, “INA's MIREX 2018 Music and Speech Detection System,” MIREX 2018, on its speech detection; ina-foss/inaSpeechSegmenter, its
smnengine, the more recent of its two: by its README, the one the papers used had no noise class. - E. Scheirer and M. Slaney, “Construction and evaluation of a robust multifeature speech/music discriminator,” ICASSP 1997: features, Tables 1 to 3, the conclusion.
@audio/neural-denoise0.7.0, its README: the music guard,segments(), the kinds test (scripts/accuracy.mjs kinds test), speed.@audio/neural-tag0.1.0,packages/neural-tag, its README: features, verification against Keras, the model file, speed.- The sounds read here and not played: EBU SQAM (Tech 3253) excerpts as the declipping survey of Záviška, Rajmic, Ozerov and Rencker uses them (rajmic/declipping2020_codes); J. Thiemann, N. Ito, E. Vincent, DEMAND, channel 1 of NRIVER, NPARK, NFIELD, DWASHING, OHALLWAY; Mihai Sorohan, solo trumpet 06, CC BY 3.0; US Army Strings, Brahms, Hungarian Dance no. 5, Musopen, public domain; Kevin MacLeod, Dance of the Sugar Plum Fairy and Vibe Ace, CC BY 3.0; audiojs/audio's
test/fixture.wav. Played: the blackbird, Diana Tudor, xeno-canto XC1059970, CC BY 4.0, an excerpt; NASA, Houston We Have a Podcast 434, public domain. The rest are made insounds.js. - Precise Tone Plan: dial tone, 350 and 440 Hz.
- RicherMans/CED; mispeech/ced-tiny, mAP on AudioSet's full training set.
- Q. Kong et al., “PANNs: Large-Scale Pretrained Audio Neural Networks for Audio Pattern Recognition,” 2019, the abstract.
- Y. Gong, Y.-A. Chung, J. Glass, “AST: Audio Spectrogram Transformer,” 2021; MIT/ast-finetuned-audioset-10-10-0.4593, named for its mAP.
- laion/clap-htsat-unfused; its ONNX files, Xenova/clap-htsat-unfused.
- MediaPipe Audio Classifier.