Choose log-mel when
You have thousands of labelled examples or can generate them by augmentation, the model is a CNN or CRNN, and it must run on a small processor. It is also the safe starting point when nothing else is known.
Audio & Acoustics · Comparison
Short answer: For sound event detection and audio classification with a neural network, the log-mel spectrogram is the default input: it keeps the time-frequency structure that convolutional and transformer models learn from. MFCCs compress each frame into a few coefficients, which suits small classical models and very tight memory, but they throw away detail a network could have used. Pretrained audio embeddings are usually the strongest choice when labelled data is small, because a model trained on a large audio collection has already learned general sound features; the price is a larger model on the device or a server. Choose by the amount of labelled data first, then by the compute budget.
A guide for teams building detectors for alarms, glass breaks, machine states, coughs or other target sounds. We compare the three inputs on what they keep, what they cost and how much labelled data they need.
Side by side
All three start from the same short-time spectrum. They differ in how much they compress it and in how much prior knowledge they bring.
| Criterion | Log-mel spectrogram | MFCC | Pretrained embeddings |
|---|---|---|---|
| What it is | Short-time spectrum passed through a mel filterbank, then a log. Typically 40 to 128 bands per frame. | A discrete cosine transform of the log-mel energies, keeping the first coefficients, typically 13 to 20, often with deltas. | The output of a network trained on a large audio collection, with or without labels. One vector per frame or per clip. |
| What it keeps | The spectral envelope and much of the fine structure, with neighbouring bands still next to each other. | The smooth spectral envelope. Pitch and narrow spectral detail are mostly removed, and coefficients are decorrelated. | Whatever the pretraining task made useful. Good for general sound categories, not guaranteed for unusual signals. |
| Fits which model | CNNs, CRNNs and transformers, which exploit local patterns in time and frequency. | GMMs, SVMs, tree ensembles and small dense networks. Less suited to CNNs, because the cosine transform removes locality along frequency. | A small classifier on top: logistic regression, a shallow network, or fine-tuning of the upper layers. |
| Labelled data needed | The most of the three when training from scratch; augmentation helps. | Moderate. Small models on compact features can train on modest datasets, with a lower accuracy ceiling. | The least. Often workable with tens to hundreds of examples per class. |
| Compute on the device | Window, FFT, filterbank and log on every hop, plus the model. | The same front-end plus a small cosine transform. The saving is in the smaller model input. | The embedding network itself, usually millions of parameters. Often too heavy for a microcontroller, feasible on a phone or an applications processor. |
| Main risks | Mel spacing blurs high frequencies, so narrow high-frequency tones can be lost. The log is sensitive to level and to the microphone response. | Additive noise disturbs every coefficient. The lost detail limits accuracy on sounds that differ mainly in fine structure. | A fixed sample rate and input format, domain mismatch on signals unlike the pretraining data, and licence terms on the weights. |
Counts and sizes are typical values from common practice, not measurements. Which input scores best on a given task has to be checked on held-out recordings from the target device.
When each one wins
Many pretrained audio models take log-mel input themselves, so the three options are stages of one pipeline as much as rivals. The question is how much of that pipeline you train and how much you ship.
You have thousands of labelled examples or can generate them by augmentation, the model is a CNN or CRNN, and it must run on a small processor. It is also the safe starting point when nothing else is known.
The classifier is a small classical model, memory is counted in kilobytes, or an existing fixed-point front-end already produces them. For speech-like tasks with a tiny model they remain a reasonable baseline.
Labels are few, classes are everyday sounds close to the pretraining data, and the platform can run the embedding model. A common route to the edge is to use the large model as a teacher or labeller and distil into a small log-mel network.
How to choose
A decision list for choosing the input before the model architecture is fixed.
With only a few hundred or fewer, try pretrained embeddings with a simple classifier first. It gives a fast baseline and shows whether the classes are separable at all.
Sample rate, frequency range and sound type must match. Ultrasonic content, vibration signals and very narrow tones may need log-mel or a linear spectrogram trained on your own data.
Flash, RAM and cycles per hop decide whether an embedding model can ship. If not, plan for a compact log-mel model, or MFCCs with a classical classifier on the smallest parts.
Window, FFT size, band edges, log offset and normalization must match numerically. A mismatch here is a frequent cause of a model that works in the notebook and fails in the product.
Evaluate the candidates on recordings from the target microphone, with event-based metrics and false alarms per hour, not only clip accuracy.
Before we start
A mel spectrogram is the short-time power spectrum grouped into mel-spaced frequency bands, usually followed by a log. MFCCs go one step further: a discrete cosine transform of those log energies, keeping only the first coefficients. MFCCs are therefore a compressed, decorrelated summary of the log-mel spectrum.
Not obsolete, but rarely the first choice with neural networks. Networks generally do better on log-mel input, where the detail is still present. MFCCs remain useful with small classical models and on very constrained hardware.
Common choices are 40 bands for small on-device models and 64 to 128 for larger ones. More bands keep more frequency detail and cost more compute and memory. The right number depends on the sounds: tonal, narrow-band events need finer resolution than short impacts.
Usually not directly, because the embedding models are too large. Practical options are to run the embedding model on a phone or gateway, or to distil it into a small model that takes log-mel input. Our on-device audio AI page covers the budgets involved.
It is possible, and some large models do. Learned front-ends need more data and compute to match what a mel filterbank gives for free, so for small and medium datasets log-mel input is the more reliable choice.
Keep exploring
Audio & Acoustics · Mel Spectrogram vs MFCC vs Embeddings
Share the problem, the data you have and what success would look like. We’ll discuss a practical next step.
Please don’t include confidential datasets, credentials or patient information.
yochai@mlaia.com
WhatsApp: +972 52 484 6282