Error message wording when n_fft is larger than length of the input

See original GitHub issue

BEFORE POSTING A BUG REPORT Please look through existing issues (both open and closed) to see if it’s already been reported or fixed!

Describe the bug The error/warning message when n_fft is larger than the length of the input seems to be the wrong way around. Currently, I get n_fft=2048 is too small for input signal of length=512. Shouldn’t it be n_fft=2048 is too *large* for input signal of length=512?

To Reproduce

import librosa
y = librosa.tone(220, length=512)
librosa.stft(y, center=False)

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Software versions* INSTALLED VERSIONS

python: 3.8.3 (default, Jul 2 2020, 16:21:59) [GCC 7.3.0]

librosa: 0.8.0

audioread: 2.1.8 numpy: 1.19.1 scipy: 1.5.2 sklearn: 0.23.1 joblib: 0.16.0 decorator: 4.4.2 soundfile: 0.10.3 resampy: 0.2.2 numba: 0.50.1

numpydoc: None sphinx: None sphinx_rtd_theme: None sphinxcontrib.versioning: None sphinx-gallery: None pytest: None pytest-mpl: None pytest-cov: None matplotlib: 3.3.0 presets: None

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
bshallcommented, Feb 16, 2021

@miltonG-isla, @bneslyn21 This is issue is just about the wording of the error message. The actual code (including the > sign) is doing the correct thing and shouldn’t be changed.

If you want to get rid of the error you should either use a smaller value for n_ftt or pad your input.

3reactions
bmcfeecommented, Aug 1, 2020

Ah good catch. I think this is purely cosmetic (the behavior is correct, but the description is wrong). But we should fix it for the next release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

STFT error about segement length more than long input signal
If bv has a size of 110x1 or 1x110, then you're trying to calculate a spectrogram of a 110-long time-series using a 10000-sample...
Read more >
Julia DSP Periodograms n > nfft is error, why? - Stack Overflow
I think that the FFT length nfft should be greater than the signal length n to prevent aliasing. The periodogram function uses FFT...
Read more >
What is the effect of reducing NFFT less than the signal length
If N>M, i.e., the DFT length is greater than the length of the time-domain signal, it is typically assumed that x[k]=0 for k≥M....
Read more >
3.12 HeatWave ML Error Messages - MySQL :: Developer Zone
Message : The size of model generated is larger than the maximum allowed ... Example: ERROR HY000: "ML003015: The input column types do...
Read more >
Fourier Transforms With scipy.fft: Python Signal Processing
The resulting frequency spectrum would show three peaks, one for each of the notes. If the person played one note more softly than...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found