Processing Blocks
Spectrogram
A mel-scaled picture of sound energy over time, measured in decibels.
Try it in StudioOn this page
What is this block?
Spectrogram turns one window of sound into a grid of energy over time and pitch, like MFE. The main differences are its default frame sizes and that it measures energy in decibels (dB).
Why do we use it?
Many sounds that are not speech, such as engines, alarms and taps, are recognised by where their energy sits in pitch and how it changes. A spectrogram shows exactly that, in a compact grid a learning block can read.
How does it work?
- Cut the window into overlapping frames (256 samples long, every 128 samples by default).
- Measure each frame's frequencies with an FFT.
- Group them into 32 mel bands, from 0 Hz up to half the sample rate.
- Convert each band's energy to decibels (10 × log10).
- Raise very small values to the Noise floor (dB).
What input does it receive?
One audio window from the impulse, for example 1000 ms of sound at 16 000 Hz (16 000 samples).
What output does it produce?
A grid of frames × 32 mel bands. For a 1-second window at 16 kHz with the defaults: 124 × 32 = 3,968 numbers.
What do its settings mean?
Settings are on the block's Parameters tab.
| Setting | Default | What changing it does |
|---|---|---|
| Frame length | 256 | Length of each frame in samples (16 ms at 16 kHz). |
| Frame stride | 128 | Samples between frame starts. Smaller gives more frames. |
| FFT length | 256 | Points in each FFT. Must be a power of 2 and at least the frame length. |
| Noise floor (dB) | −52 | Values below this are raised to it. |
The number of mel bands is fixed at 32.
Simple example
You record kettle, microwave beep and noise. The beep shows a bright line at one pitch, the kettle shows wide energy that grows over time, and noise stays low. These patterns are easy to see in the 124 × 32 grid.
When should I use it?
- Use it for non-speech sounds such as machines, alarms and appliances.
- Compare it with MFE on the same data. Both work well with the Classification learning block.
- If training is slow or the model is too large, try MFE with fewer filters.