What's the differences between functions in librosa.core and librosa.feature?

794 views
Skip to first unread message

Denghao Li

unread,
Mar 14, 2018, 8:56:15 PM3/14/18
to librosa
I mean the differences between librosa.stft and librosa.feature.chroma_stft,  librosa.cqt and librosa.feature.chroma_cqt. Which should I use?

Brian McFee

unread,
Mar 15, 2018, 8:30:12 AM3/15/18
to librosa
I'm not sure I understand the question, but here's a quick description of the methods you're asking about.

  • STFT is a standard short-time fourier transform.  The signal is broken into sliding windows and each window is transformed by the FFT.
  • CQT differs from STFT in two major ways: 1) the frequency scale is logarithmic, not linear.  2) the window length is different for each frequency: low frequencies use long windows, high frequencies use short windows.
  • chroma_stft uses the STFT to generate a spectrogram, and then projects that spectrum down to a single-octave (chroma) representation.
  • chroma_cqt is similar, but uses the CQT instead of the STFT.
In general, I recommend chroma_cqt over chroma_stft.  The documentation provides an example comparing the two: https://librosa.github.io/librosa/generated/librosa.feature.chroma_cqt.html#librosa.feature.chroma_cqt 

And the example gallery has an example showing how to post-process chroma features for a clearer representation of harmonic content: https://librosa.github.io/librosa/auto_examples/plot_chroma.html#sphx-glr-auto-examples-plot-chroma-py 
Reply all
Reply to author
Forward
0 new messages