#2704 Waterfall contrast for weak signals relative to the noise floor (#2712)

The waterfall mapped 256 palette indexes over the absolute dBFS level of the
mean bin value, about 2.5 steps per dB at a -100 dBFS floor, so weak signals
were only a few steps above the noise.  WaterfallScaler now tracks the noise
floor as a smoothed 25th percentile of the bins (robust to occupied spans) and
maps a fixed 45 dB span above it, so contrast no longer depends on sample size,
DFT size or tuner gain.  The classic palette's flat blue blocks are replaced
with a blue ramp over the bottom quarter, where the noise floor now sits.

Co-authored-by: denny <dennis.sheirer@gmail.com>
This commit is contained in:
Denny Sheirer
2026-11-20 02:47:57 -05:00
committed by GitHub
parent 838e7708c0
commit 8324233acb
8 changed files with 799 additions and 78 deletions

View File

@@ -33,44 +33,31 @@ public class WaterfallPalette
}
/**
* Palette of the original Swing waterfall: dark blue noise floor, a blue to yellow ramp, yellow fading to orange,
* then red.
* Palette based on the original Swing waterfall colors: a dark to bright blue ramp, a blue to yellow ramp, yellow
* fading to orange, then red. The blue ramp covers the bottom quarter of the palette, where the waterfall places
* the noise floor, so the noise stays blue and weak signals stand out from it.
*/
public static int[] classic()
{
int[] palette = new int[SIZE];
for(int x = 0; x < 16; x++)
for(int x = 0; x < 64; x++)
{
palette[x] = argb(0, 0, 127);
palette[x] = argb(0, 0, blend(64, 191, x / 63.0));
}
for(int x = 16; x < 32; x++)
for(int x = 64; x < 100; x++)
{
palette[x] = argb(0, 0, 191);
double t = (x - 64) / 36.0;
palette[x] = argb(blend(0, 255, t), blend(0, 255, t), blend(191, 0, t));
}
int r = 0;
int g = 0;
int b = 191;
for(int x = 32; x < 60; x++)
for(int x = 100; x < 220; x++)
{
palette[x] = argb(r, g, b);
r += 9;
g += 9;
b -= 6;
palette[x] = argb(255, blend(255, 0, (x - 100) / 120.0), 0);
}
g = 255;
for(int x = 60; x < 188; x++)
{
palette[x] = argb(255, g, 0);
g -= 2;
}
for(int x = 188; x < SIZE; x++)
for(int x = 220; x < SIZE; x++)
{
palette[x] = argb(255, 0, 0);
}
@@ -78,6 +65,11 @@ public class WaterfallPalette
return palette;
}
private static int blend(int from, int to, double fraction)
{
return (int)Math.round(from + (to - from) * fraction);
}
/**
* Palette that blends linearly between evenly spaced colors.
* @param colors web color strings (for example #440154), lowest intensity first