TransWikia.com

Frequency range for STFT in Librosa

Signal Processing Asked by Cralle on November 13, 2021

I am currently looking at the STFT for Librosa. I was wondering how to understand the output of the STFT function, specifically what kind of frequencies the different values represent.

Say I have a n_fft of 256, that means that the shape output of the STFT will be 129 (1+n_fft/2). I therefore understand that for each frame I have 129 bins, these bins represent some sort of frequency within this frame. I am assuming that the bins start with a frequency of 0hz and go up to some value, with each bin representing an equally large range.

But how do I figure out what the maximum frequency used for STFT is? And what about the range of each of the 129 bins?

Just to be clear, I have tried looking at the source-code and at the documentation, but I have not really become much wiser.

One Answer

Having a look into the sources of librosa.display.specshow reveals how bins are converted into frequencies internally: The plotting uses librosa.core.fft_frequencies, which shows that it is basically the same as numpy.fft.fftfreq:

>>> librosa.fft_frequencies(sr=22050, n_fft=16)
array([     0.   ,   1378.125,   2756.25 ,   4134.375,
         5512.5  ,   6890.625,   8268.75 ,   9646.875,  11025.   ])

Answered by bluenote10 on November 13, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP