Jan Stary <h...@stare.cz> writes: > Yes, this diff fixes it, and looking at sox -V4 > it does the right thing: > > $ sox -c 1 -b 16 -r 1000 -n file.wav synth 1 sin > $ sox -V4 file.wav -n spectrogram -x 5000 > > [...] > sox DBUG spectrogram: duration=1 x_size=5000 pixels_per_sec=5000 dft_size=1024 > sox DBUG spectrogram: window_density=0.5 > sox INFO spectrogram: actual pixels/s = 1000 > sox DBUG spectrogram: step_size=1 block_steps=1 > [...] > sox DBUG sox: start-up time = 0.001902 > sox DBUG spectrogram: cols=489 left=0 end=24 > sox DBUG spectrogram: flushed cols=1001 left=0 end=-512 > sox DBUG spectrogram: signal-max=-1.1134 > > Thank you!
Thanks for testing. I've pushed the fix to the SF repo. > Jan > > diff --git a/src/spectrogram.c b/src/spectrogram.c > index 3dcda69c..89ae1fbf 100644 > --- a/src/spectrogram.c > +++ b/src/spectrogram.c > @@ -431,7 +431,7 @@ static int start(sox_effect_t *effp) > actual = make_window(p, p->last_end = 0); > lsx_debug("window_density=%g", actual / p->dft_size); > p->step_size = (p->slack_overlap ? sqrt(actual * p->dft_size) : actual) + > 0.5; > - p->block_steps = effp->in_signal.rate / pixels_per_sec; > + p->block_steps = max(effp->in_signal.rate / pixels_per_sec, 1); > p->step_size = > p->block_steps / ceil((double)p->block_steps / p->step_size) + 0.5; > p->block_steps = floor((double)p->block_steps / p->step_size + 0.5); > -- Måns Rullgård _______________________________________________ SoX-devel mailing list SoX-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sox-devel