stft frame count calculator
STFT Frame Count Calculator guide
A spectrogram has one time column per analysis window. You can predict the column count before allocating an array or comparing a plugin export with a script. Enter the clip length in sample frames per channel, then supply the same window and hop used for analysis.
Play the instrument ↑- Default result
- 184 complete windows
Calculation and units
For a signal of L frames, window W and hop H, start indices are 0, H, 2H and so on. A start qualifies when start + W is at most L. The count is zero below one full window, and otherwise one plus the integer floor of (L − W) / H.
Worked examples
Select a named case in the Worked example control to load these values. You can then edit any input to compare the result.
One second of audio
Signal length (frames) = 48000 · Window length (frames) = 1024 · Hop length (frames) = 256.
184 complete windows. 47872 input frames covered · 128 trailing frames outside the final complete window. Frame zero starts the first unpadded window.
At 48 kHz the record lasts exactly a second. The last window must fit inside the record even when its starting point sits on the hop grid.
Exactly one window
Signal length (frames) = 1024 · Window length (frames) = 1024 · Hop length (frames) = 256.
1 complete window. 1024 input frames covered · 0 trailing frames outside the final complete window. Frame zero starts the first unpadded window.
There is room for the first window, which starts at frame zero. A hop is needed only to reach a second start.
Too short for one window
Signal length (frames) = 1023 · Window length (frames) = 1024 · Hop length (frames) = 256.
0 complete windows. 0 input frames covered · 1023 trailing frames outside the final complete window. Frame zero starts the first unpadded window.
A single missing frame removes the entire first column under the complete-window policy. A library that pads at the boundaries will show a different count.
Adjacent blocks
Signal length (frames) = 4096 · Window length (frames) = 1024 · Hop length (frames) = 1024.
4 complete windows. 4096 input frames covered · 0 trailing frames outside the final complete window. Frame zero starts the first unpadded window.
With the hop equal to the window length, four neighboring blocks partition this clip without sharing any samples along their boundaries.
Just before another start fits
Signal length (frames) = 1279 · Window length (frames) = 1024 · Hop length (frames) = 256.
1 complete window. 1024 input frames covered · 255 trailing frames outside the final complete window. Frame zero starts the first unpadded window.
The window starting at frame 256 would run one frame beyond the record. Keep the unused suffix if this is a streaming analysis.
Exactly two windows
Signal length (frames) = 1280 · Window length (frames) = 1024 · Hop length (frames) = 256.
2 complete windows. 1280 input frames covered · 0 trailing frames outside the final complete window. Frame zero starts the first unpadded window.
The second window ends at the exclusive boundary 1280. Compare with the previous preset to see why integer flooring matters.
Interpreting the result
Read the uncovered suffix separately from overlap. Two adjacent windows can share hundreds of samples while the last few samples still fall outside every window. In streaming code, preserve a partial tail across input callbacks if another block of input is likely to arrive.
Measurement and model limits
This model starts at frame zero, with no center padding, boundary extension or final partial block. It accepts hop sizes up to the window length so the reported coverage forms a continuous interval. FFT size can exceed window length without changing how many time columns fit.
Answers before you play
Common questions
Does stereo double the count?
No. A stereo frame contains one simultaneous value per channel. Apply the same boundaries to each channel and obtain the same number of time columns per channel.
Why is one added after the division?
The first complete window starts at zero before any hop occurs. Counting only hops would give zero columns for a clip exactly one window long.
Will increasing FFT size change the answer?
Only if it changes the number of input frames consumed by each analysis window. Padding a fixed window before an FFT changes the frequency grid.
How do I match a centered library call?
Check the library's left and right padding and final-window policy first. Use the effective padded length only when its start grid also matches this model.