The FFT, Part 2: Bins, Windows, and Why the Stock Panadapter Looks That Way
Diving into the mechanics of the Fast Fourier Transform, resolution bandwidth, and spectral leakage using the stock sBitx panadapter as a real-world case study.
In Part 1, we looked at the fundamental difference between how hardware captures radio signals (the Time Domain) and how we as operators actually want to see them (the Frequency Domain). We also looked at how the sBitx takes a raw, 1D audio stream from its ADC and mathematically constructs a 2D complex I/Q stream centered at 0 Hz.
Now that we have that clean stream of complex time-domain samples, it is time to feed it into the main event: the Fast Fourier Transform (FFT).
Rather than just throwing dry textbook formulas at you, we are going to look at the mechanics of the FFT through the lens of the stock sBitx panadapter. By understanding how the FFT calculates frequency data, you will see why the baseline sBitx display struggles to separate closely spaced signals on a busy band—and why simply “zooming in” on the screen doesn’t actually help.
Some housekeeping notes. By “stock” I mean the 64-bit sBitx software at v5.4, before I started poking at it. And my sBitx is currently on the bench waiting for a repair, so the screenshots in this post come from that stock software running against a simulated radio, fed a real off-air recording of a busy 20 m FT8 band. The software drew every pixel. Only the hardware is pretend. One last note: this post digs into the stock panadapter’s limitations quite a bit. Those design choices make a lot of sense for keeping a standalone Raspberry Pi transceiver lean, responsive, and easy to hack on; they just run out of headroom when you push the waterfall hard on a packed digital band. I have huge respect for the developers who built and maintain this open-source project, and I’m only able to tinker with it because of the foundation they laid.
1. The Algorithmic Magic: DFT vs. FFT
Before we look at the pixels on the screen, we have to appreciate the computer science miracle happening under the hood.
Remember that the mathematical bridge from the time domain to the frequency domain is the Discrete Fourier Transform (DFT). Conceptually, the DFT is brute-force pattern matching. If you have a block of N samples and you want to know how much energy exists at 1,000 Hz, you multiply every single sample in your block against a mathematical 1,000 Hz test wave and sum the results.
If you want to check N different frequencies across N samples, the CPU has to perform N complex multiplications N times. In computer science terms, this has a time complexity of O(N2). O(N2) is usually bad.
I won’t go into the details on O notation and complexity. As a simple example, let’s look at sorting algorithms. Slow sorting algorithms, like Insertion Sort, are O(N2). If you want to sort a list of one million items with an insertion sort, you’ll typically end up comparing one item in the list to another item (to see which one should come first) something on the order of hundreds of billions of times!
In comparison, a fast sorting algorithm (like Merge Sort) has a time complexity of O(N log2 N). Sorting that same list will typically need to do around 20 million comparisons. That might seem like a lot, but it’s roughly a 10,000x improvement for a million-item list like that.
Sort algorithms are their own fascinating rabbit hole. If you find it interesting, then computer science might be for you!
On a resource-constrained single-board computer like the Raspberry Pi 4 inside the sBitx, O(N2) is a death sentence for real-time radio.
Enter Cooley and Tukey
In 1965, James Cooley and John Tukey popularized an algorithm that changed the world: the Fast Fourier Transform (FFT). (Fun fact: Carl Friedrich Gauss actually figured this out in 1805 while trying to calculate asteroid orbits by hand, but it wasn’t published until after his death, so Cooley and Tukey get the fame.)
The FFT exploits the fact that sine and cosine waves are symmetrical and periodic. If you choose a sample block size (N) that is a power of 2 (like 512, 1024, or 2048), you don’t have to recalculate every multiplication from scratch. You can recursively split the block into even-indexed samples and odd-indexed samples, solve the smaller pieces, and combine them.
This divide-and-conquer trick drops the computational workload from O(N2) down to O(N log2 N) (that sounds familiar!).
To put that into perspective using a 2,048-point transform:
- Standard DFT: 2,0482 = 4,194,304 operations per block.
- The FFT: 2,048 × log2(2,048) = 2,048 × 11 = 22,528 operations per block.
That is a 186x speedup. And if we want to scale up to a high-resolution 16,384-point transform later? The FFT is over 1,170 times faster than the DFT. Without this specific algorithm, the Raspberry Pi would completely choke, and real-time software-defined radios simply wouldn’t exist.
2. Anatomy of an FFT Output: What is a “Bin”?
When you pass a block of N complex I/Q samples into an FFT library (the sBitx uses FFTW3, the fastest C library in the west), it hands you back an array of N frequency buckets, called bins. One block of samples goes in, one row of bins comes out:
The most important metric of any panadapter is its Frequency Resolution (or Resolution Bandwidth, Δf). How wide is each individual bucket? The formula is dead simple:
$$\Delta f = \frac{f_s}{N}$$
Where:
- fs is the Sample Rate (in Hz).
- N is the FFT Size (the number of samples/bins).
For readers familiar with the Shannon-Nyquist theorem, you might wonder why our resolution bandwidth formula doesn’t halve the sample rate to account for the 48 kHz Nyquist limit. It doesn’t need to. An N-point FFT of samples taken at fs always gives you bins fs / N apart, real input or complex. Nyquist decides how much of that spectrum is unique, not how wide each bin is. With real-valued samples straight off the codec, the top half of the bins is a mirror image of the bottom half, which is why Part 1 talked about a 48 kHz slice. Once our SDR pipeline turns them into complex I/Q, the bins read as positive and negative offsets from the center tuning frequency instead of a mirror image, but they are still 96,000 / 2,048 Hz apart.
The Stock sBitx Math (And the FT8 Problem)
Let’s plug the baseline sBitx numbers into that equation. The sBitx’s WM8731 audio codec samples the incoming signal at 96,000 Hz (96 kHz), and the stock panadapter feeds that into a hard-coded 2,048-bin FFT:
$$\Delta f = \frac{96{,}000\text{ Hz}}{2{,}048\text{ bins}} = \mathbf{46.875}\textbf{ Hz}$$
Every single bucket on the stock sBitx spectrum analyzer represents a chunk of spectrum ~47 Hz wide.
At first glance, 47 Hz might sound pretty small. If you are looking at a 3,000 Hz wide Single Sideband (SSB) voice signal, it spans across roughly 64 bins—plenty of detail to see someone talking.
Technical detail: the stock display FFT really is complex. The software mixes the codec’s real-valued samples down into I/Q first (the trick from Part 1) and then runs a 2,048-point complex FFT on that, so the bin math above holds exactly as written. One wrinkle: the screen never shows all 2,048 bins. The display code only keeps the 534 in the middle, which is where the 25 kHz maximum span comes from. The other three quarters get computed and then ignored; mostly it’s data that isn’t very useful, due to DSP artifacts and hardware filtering, but the result is a limited number of bins for a fairly wide slice of spectrum.
But what happens when you switch to a narrow digital mode like FT8?
An individual FT8 signal is only 50 Hz wide. Furthermore, FT8 operators don’t transmit in neat, pre-defined 50 Hz channels; anyone can click anywhere on the waterfall and start transmitting at an arbitrary frequency offset.
Now think about what happens when a 50 Hz wide FT8 signal hits a grid of fixed 46.88 Hz wide FFT bins:
- Because the signals aren’t aligned with the bin boundaries, a single 50 Hz FT8 signal will almost always straddle two adjacent bins, lighting up 94 Hz of visual width on the display.
- If two FT8 stations are transmitting with a 30 Hz gap between them, that gap is narrower than a bin, so no bin ever sits entirely inside it. Whichever bin holds the gap also catches an edge of one station or both.
- Instead of seeing two distinct signals with a clear gap between them, you get bins full of signal energy all the way across, and the display renders a single, unbroken wall of signal.
- In practice it is a little worse than that. The window function the display applies (more on windows in section 4) smears every signal across an extra bin or so, which is why the strong stations in the screenshot below are three to five bins wide, not two.
The same coarseness hides the outer edges, too. Take two signals with 70 Hz of clear air between them, which is plenty of room for another station. Each one gets drawn as a 94 Hz block whose edges sit on bin boundaries, not where the signal actually starts and stops, and that 70 Hz of room comes out looking like a 47 Hz squeeze. That’s the lucky case, too. About half the time the bin boundaries land so that no bin is completely empty, and the gap disappears altogether:
Now the real thing. On a busy FT8 sub-band, ~47 Hz bins are almost the exact same size as the 50 Hz signals themselves. Because signals straddle bin boundaries, adjacent stations blur together, making it nearly impossible to visually find an open slot to transmit:
The “Digital Zoom” Illusion
When you can’t tell two signals apart on a screen, your natural instinct is to zoom in. The sBitx lets you narrow the panadapter span from 25 kHz all the way down to a tight slice of the band.
However, in the stock sBitx code, the number of FFT bins is hard-coded.
When you zoom in from the 25 kHz span to the 6 kHz span, the software doesn’t re-run the math to give you smaller, sharper bins. It simply takes the exact same 46.88 Hz bins from the middle of the array and stretches them wider across the screen. At the narrowest 2.5 kHz span, you only have about 53 bins of actual data being stretched across the whole width of the display!
In photography terms, it is pure digital zoom, not optical zoom. You aren’t revealing any new detail between those FT8 signals; you are just magnifying the pixels of the existing coarse buckets.
At the narrowest span, 2.5 kHz, every one of those rectangles is a single 47 Hz bin. Zooming in just made the blocks bigger:
From Complex Bins to Screen Pixels
It is also worth noting what is actually inside each bin before it gets drawn. The FFT outputs a complex number (Real + j · Imag) for every bucket, which contains both the amplitude and phase of that frequency slice.
To draw a pixel on the waterfall, we don’t care about the phase; we just want to know how strong the signal is (its magnitude). In C, the software calculates the hypotenuse of the complex triangle using the Pythagorean theorem, and then converts it to Decibels (dB):
$$\text{Magnitude} = \sqrt{\text{Real}^2 + \text{Imag}^2}$$
$$\text{Power (dB)} = 20 \log_{10}(\text{Magnitude})$$
Why convert to a logarithmic scale like decibels? Because radio signals have an absurd dynamic range. A booming local station might be millions of times more powerful than a weak DX (long-distance) station hovering just above the noise floor. If we plotted raw linear voltage on the screen, weak signals would be completely invisible flatlines at the bottom of the graph. Decibels compress that massive range so we can see the whispers and the shouts at the same time.
3. The Fundamental Trade-off: Time vs. Frequency
At this point, as a software engineer, the fix for our FT8 resolution problem seems obvious: “If 2,048 bins gives us blocky 46.88 Hz resolution, why don’t we just change the constant in the C code and crank N up to 32,768 or 65,536 bins?!”
Welcome to the fundamental trade-off of Digital Signal Processing—the Gabor Limit (essentially the Heisenberg Uncertainty Principle applied to signals). You cannot have ultra-sharp frequency resolution and instantaneous time resolution at the same time.
When processing an incoming signal, the stock sBitx software runs each 2,048-sample block through the FFT twice: once for the receive chain (demodulation, noise reduction, equalization, etc, before it gets turned back into the real-valued audio stream that you hear) and once more for the panadapter. Same block, same bin count, for the whole DSP pipeline. The number of bins is hard-coded and many pieces of the software depend on the number of bins being set to exactly 2,048. This assumption is at the core of the software and everything will fall apart if you blindly change it. So in addition to the theoretical reason, there’s the practical reality of how much things would break. Similarly, the 96 kHz sample rate is hard-coded in the software and even baked into the hardware itself.
Think about what the hardware has to do before the FFT can run. At a fixed sample rate of 96,000 samples per second, collecting N samples takes physical time (T):
$$T = \frac{N}{f_s} = \frac{1}{\Delta f}$$
Look at what happens when we compare different FFT sizes at 96 kHz:
| FFT Size (N) | Bin Width (Δf) | Time to Fill Block (T) | Max Naive Frame Rate | Visual Result |
|---|---|---|---|---|
| 512 | 187.50 Hz | 5.3 ms | ~188 FPS | Buttery smooth waterfall, but terrible, blurry frequency resolution. |
| 2,048 (Stock) | 46.88 Hz | 21.3 ms | ~47 FPS | Fast updates, but coarse resolution that blurs FT8 signals together. |
| 16,384 | 5.86 Hz | 170.7 ms | ~5.9 FPS | Razor-sharp FT8 separation, but a sluggish, ~6 FPS waterfall. |
| 65,536 | 1.46 Hz | 682.7 ms | ~1.5 FPS | Incredible frequency detail, but updates less than twice a second! |
If you want a 1.5 Hz bin resolution by naively waiting for a 65,536-sample buffer to fill up from scratch, you have to listen to the band for nearly 700 milliseconds per frame. By the time the FFT runs, a fast 30 WPM (words per minute) Morse code “dit” (which only lasts about 40 milliseconds) has already started and finished about eight times. Your waterfall turns into a choppy slideshow.
(Spoiler for Part 3: We can cheat this frame-rate limit! While we can’t cheat the physics of how much data is needed for narrow bins, we don’t have to wait for a brand-new block of samples to fill up from scratch before running the next FFT. By using a sliding circular buffer with overlapping windows, we can feed the FFT mostly recent data coupled with a small chunk of brand-new samples on every frame—giving us narrow bins AND a fast, smooth frame rate! What overlap can’t do is un-blur time: every frame is still looking at the last N samples, no matter how often you draw one. That will come back to bite us.)
4. Spectral Leakage and Windowing
Even if you increase the number of bins, there is one more massive quirk of the FFT that will ruin your ability to spot weak FT8 signals next to strong ones if you aren’t careful: Spectral Leakage.
The mathematical equations inside the FFT make a critical, hidden, and fundamentally incorrect assumption: they assume that the finite block of N samples you handed it repeats infinitely in a continuous loop.
Imagine taking your block of samples and gluing the end of the block directly to the beginning to form a circle:
- If a pure 1,000 Hz sine wave happens to complete an exact integer number of cycles (say, exactly 50.0 cycles) inside your sample block, the start and end points match up seamlessly. The FFT outputs a single, needle-sharp spike in one bin.
- In the real world, that almost never happens. A random signal off the air might complete 50.37 cycles inside your sample block. When the FFT mentally glues the end of the block back to the beginning, there is a violent, instantaneous cliff where the wave jumps from its ending voltage back to its starting voltage.
The “Sharp Edge” Problem
Here is the catch: Fourier’s theorem dictates that you cannot draw a sharp, jagged edge using a single, pure frequency. To mathematically recreate that sudden cliff, the FFT is forced to mix in dozens of other frequencies.
Instead of putting 100% of the signal’s energy into the correct bin, the FFT takes a percentage of that energy and splatters it outward into the neighboring bins to account for the jagged edge. This is spectral leakage.
This leakage happens to every mismatched signal, but it is devastating when a signal is loud. The leakage is proportional: if a booming, powerful local station splatters just 1% of its massive energy into the bins next door, that 1% is enough to completely artificially raise the noise floor in those bins, swamping out any weak DX stations transmitting nearby.
Here is that cliff, drawn next to the fix we are about to get to:
On the stock panadapter, leakage looks like this. The base of one very strong signal flares out into wide “skirts” for a few hundred hertz either side, raising the apparent noise floor in neighboring bins and hiding weak signals:
The Fix: Windowing Functions
To stop the edges of our sample block from crashing into each other, we have to smooth them out before we run the FFT. We do this by multiplying our block of time-domain samples against a Window Function (such as a Hann or Blackman-Harris window).
A window function is simply a bell-shaped curve that starts at (or very near) 0.0 at sample 0, rises smoothly to 1.0 in the dead center of the block, and tapers gracefully back down at sample N-1. Hann goes all the way to exactly 0.0 at both ends.
By pinching both ends of our sample block down to zero, the start and end of the block always match up perfectly (at zero!). The artificial cliff disappears, the side-lobes drop dramatically, and strong signals stay close to their own bins instead of splattering across the band.
The stock sBitx code already does this for the display: before the FFT that feeds the panadapter and waterfall, it multiplies each 2,048-sample block by a Hann window. (The receive path runs its own FFT on the same block for filtering, and that one stays unwindowed.)
So the skirts in the screenshot above are what leakage looks like with a window, when the signal is about 70 dB above the noise and the bins are 47 Hz wide. Without one it would be far uglier. Below is one strong tone, landing between bins, run both ways. With no window its skirts are still around -40 dB forty bins away; with the Hann window they fall below -80 dB within about fifteen bins:
Windows aren’t free, though. Tapering the block widens every signal by a bin or so, which is part of the FT8 blur from section 2.
Summary—And Where the Stock UI Hits Its Limits
Every time you look at an SDR waterfall, you are looking at a balancing act of these mathematical constraints:
- The FFT Size (N) relative to the sample rate dictates how narrow your frequency bins are (Δf = fs / N).
- A 2,048-bin FFT at 96 kHz locks the display into coarse 46.88 Hz bins—causing 50 Hz FT8 signals to straddle multiple bins and blur together, while turning the span control into a basic “digital zoom.”
- Naively cranking up the FFT size causes a time-domain bottleneck, slowing down the refresh rate unless you use overlapping buffers.
- Windowing functions are required to taper the edges of each sample block so strong signals don’t smear across neighboring bins via spectral leakage.
However, the math of the FFT is only half the story. Even once you understand bins and windowing, the stock sBitx panadapter also runs into a few practical UI and architectural trade-offs:
- Center-VFO Anchoring: Because the panadapter is permanently centered on your VFO (Variable Frequency Oscillator, the frequency the radio is tuned to), half of your screen is always wasted when operating upper-sideband digital modes like FT8 (where all the action happens in a 3 kHz slice above your VFO, leaving the left half of your screen monitoring dead air). Scroll back up to the FT8 screenshot in section 2 and look at the left half.
- Zooming & Tuning Scramble Your History: Change the span and the waterfall you already had stays on screen at the old scale, so for a while the top and bottom of the waterfall are drawn to two different rulers. Tuning does the same thing sideways: the old rows don’t move with the dial, so everything in your history is suddenly sitting at the wrong frequency. Because the stock waterfall scrolls rendered pixels rather than storing a ring buffer of raw spectrum frames, it can’t redraw old rows at the new scale—even though the ADC was capturing that full 48 kHz swath the whole time.
- No Independent Panning: You cannot scroll the panadapter left or right to inspect nearby signals without dragging your VFO tuning frequency along with it.
This is where we are headed. Same recording, same moment, same dial, with the stock panadapter on the left and the reworked one on the right:
In Part 3, we are going to open up the sBitx codebase and tackle all of these. We will look at how we tapped the main baseband complex I/Q stream to build an independent time-domain pipeline, utilizing a Zoom FFT (mix, filter and decimate, then a 16k-point FFT) to get bins under 1 Hz wide—bringing true high-definition zooming, a waterfall that redraws its recent history when you zoom, and independent panning to the sBitx.