I was reading a paper and the authors say that they extract FFT spectrograms and log-scale in frequency domain. I understand how the general spectrogram is computed, but how to make it log-scale in frequency domain? Or maybe there are libraries in Python, which already implement this one?
With the speed of today's computers (and some optimized code) I have found a great advantage in doing Pitch Detection with a modified Logarithmic DFT instead of a FFT.
For pitch detection you are basically searching for a note's harmonics (partials) which coincidentally reside in the same frequency channels that we see on a piano's keyboard -- that is, 12 frequency channels within each octave (E, F, F#, G, G#, A, A#, B, C, C#, D, D#). The frequencies of the horizontal channels are to be logarithmically located along a vertical axis of frequency (see diagram below). So when I perform Pitch Detection (see link to my C++ source code) I construct a modified Log DFT which only probes each of the frequency channels which align to the frequencies of notes on a piano.
Since it is a DFT, we can individually adjust the center frequency for each channel so that they are logarithmically spaced and align with the frequencies of notes on a piano. And since it is a DFT, we can individually adjust the bandwidth for each of the channels by changing the number of samples used in summation -- more samples means a more narrow bandwidth for the channel. Because of the way that I gather data for my modified Logarithmic DFT, I do NOT have to apply a windowing function (nor do add and overlap) to the signal to get accurate results (number of samples in summation must be some multiple of samples in the channel's target period, usually the number samples in 17 periods).
If you look at the sonogram below (created by my C++ code), you will see a 3 second Logarithmic DFT from a guitar solo on a polyphonic mp3 recording. Notice how fine-tuned each of the horizontal channels are -- there is little bandwidth overlap, and the harmonics are clearly defined. For each note in this Log DFT we can identify their multiple harmonics extending vertically, because each harmonic will have the same time-width. Despite being a polyphonic recording, the presence of an individual note within the guitar solo is easily apparent to the naked eye.
Now being retired, I have decided to release the source code for my pitch detection engine within a free demonstration app called PitchScope Player. PitchScope Player is available on the web, and you could download the executable for Windows to see my algorithm at work on a mp3 file of your choosing. The below link to GitHub.com will lead you to my full C++ source code for Player, and you can either view and/or compile that Windows code.
To construct a Logarithmic DFT, study the DFTrowProbeCircQue class as defined in SPitchCalc.cpp
To step through a simple version of my Pitch Detection algorithm, study Make_NoteList_No_Audio() in the PitchPlayerApp.cpp file.