some question about librosa stft

73 views
Skip to first unread message

minwooking

unread,
Feb 23, 2021, 2:02:33 AM2/23/21
to librosa
hi.

i want to know the exact frequency range about that stft result.

if sample_rate value set 10000, stft method n_fft parameter set 100,
method result's frequency range is 100Hz?
If what I understand is wrong, please let me know the correct way.

It is difficult to understand because it is my first time analyzing sound.

please, help me.

Brian McFee

unread,
Feb 23, 2021, 9:14:28 AM2/23/21
to librosa
If you just want the frequencies corresponding to STFT bands, librosa.fft_frequencies() will compute that for you.

More generally, the discrete Fourier transform is defined by a collection of complex sinusoids (n_fft different frequencies) ranging from f=-sr/2 to f=+sr/2.  If your signal is real-valued (as is the case for audio signals), then the negative frequencies are redundant, so we only keep the frequencies f=0, sr/n_fft, 2*sr/n_fft, ... sr/2.  This results in a "real" Fourier transform with 1 + n_fft // 2 frequencies, in your case, 0 up to 5000 Hz in increments of 100 Hz (10000 / 100).

minwooking

unread,
Feb 23, 2021, 8:10:28 PM2/23/21
to librosa
Thank you for your help Brian.

you saved me

2021년 2월 23일 화요일 오후 11시 14분 28초 UTC+9에 Brian McFee님이 작성:
Reply all
Reply to author
Forward
0 new messages