New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strange florets in sndfile-spectrogram output #28
Comments
I think these are pretty cool, and I've seen lots of spectrograms with artifacts like these. |
Happy to have you fix this if you can but unfortunatley I'm not able to offer much in the way of time and effort here. Currently way too busy with worked related stuff. |
When the samples are read from the audio file to produce a column of pixels, the time point around which they are read is truncated to an integer value, the starting sample number. As the time distance between adjacent pixel columns is not necessarily an exact number of samples, this effectively introduces a time jitter of up to one sample period. We could mitigate this by interpolating between samples. Hypothesis: Time jitter of up to one sample due to starting moment quantization is causing this effect. Conclusion: The florets are not due to quantization of time to a sample boundary. |
I wonder if these florets are due to the side lobes of the window functions. If you look at say the Nuttall window, https://en.wikipedia.org/wiki/Window_function#Blackman.E2.80.93Nuttall_window the largest side lobes are at about -98dB. If you choose the Nuttall window and a synamic range of 95dB do these florets disappear? |
Hypothesis: It's caused by the scaling of the Y axis from speclen to height |
Got it. The calculation of magnitudes from the real and complex values in FFTW's "half complex" output format was out by one in the complex part, so mag[1] = sqrt(re[1] * re[1] + im[2] * im[2]) and so on. Here's detail of the first graph with comit 53de8b7 |
Oh, well done! Suppose this can be closed now. |
Chasing down some strange artifacts in sndfile-spectrogram's output for real music, I've made a simple example that exhibits the same artifacts, visible at the start and end of a 1-second 60Hz tone burst
http://martinwguy.co.uk/test/60Hz.wav
sndfile-spectrogram --no-border 60Hz.wav 400 8192 60Hz-kaiser.png
The following image is a 4x magnification of the bottom of the output
At normal screen resolution, these florets recede into visual imperceptibility but when applying an external log-frequency-axis wrapper to the output they are very visible at lower frequencies of the musical range.
I assume it is also this artifact that is causing the apparent tremolo in the constant tone.
Audacity on the same input file gives a dead-level line at the same FFT size and magnification.
Hypothesis: It's an artifact of our windowing function
Experiment: Try the same transform with --nuttall and see if it changes
Observation: With the other windowing functions, the output exhibits the same artifacts
with --nuttall
with --hanning
Rejected: It's not the windowing function.
The text was updated successfully, but these errors were encountered: