diff --git a/src/spectrogram.c b/src/spectrogram.c
index 26d97a9..d0bc02a 100644
--- a/src/spectrogram.c
+++ b/src/spectrogram.c
@@ -63,6 +63,7 @@ typedef struct
 	double min_freq, max_freq;
 	enum WINDOW_FUNCTION window_function ;
 	double spec_floor_db ;
+	double fft_freq ;
 } RENDER ;
 
 typedef struct
@@ -587,7 +588,7 @@ render_to_surface (const RENDER * render, SNDFILE *infile, int samplerate, sf_co
 	** Choose a speclen value that is long enough to represent frequencies
 	** down to 20Hz.
 	*/
-	speclen = height * (samplerate / 20 / height + 1) ;
+	speclen = samplerate / render->fft_freq ;
 
 	/* Find the nearest fast value for the FFT size. */
 	{	int d ;	/* difference */
@@ -771,7 +772,8 @@ main (int argc, char * argv [])
 		true, false, false, /* border, log_freq, gray_scale */
 		0.0, 0.0,           /* {min,max}_freq */
 		KAISER,
-		SPEC_FLOOR_DB
+		SPEC_FLOOR_DB,
+		20.0,               /* fft_freq */
 		} ;
 	int k ;
 
@@ -810,6 +812,15 @@ main (int argc, char * argv [])
 			continue ;
 			}
 
+		if (sscanf (argv [k], "--fft-freq=%lf", &fval) == 1)
+		{	if (fval <= 0.0)
+			{	printf("--fft-freq must be positive.\n");
+				exit(1);
+				} ;
+			render.fft_freq = fval ;
+			continue ;
+			}
+
 		if (sscanf (argv [k], "--dyn-range=%lf", &fval) == 1)
 		{	render.spec_floor_db = -1.0 * fabs (fval) ;
 			continue ;
