Order of operations when creating a spectrogram Signals noob here! I'm dipping my toes into your world by trying to recreate the Shazam algorithm, and I have a quick practical question:
When creating a spectrogram, is it better to take in a whole sound clip (say 5 seconds), and then chunk it into pieces for input to an FFT, or is it better to chunk it as the signal is being received and apply FFT as you go?
I'm asking from the perspective of ease of implementation, but if there are other considerations, I'd be happy to hear them.
To get a spectrogram using existing libraries, it is usually easier to do it for a whole auduio clip. For example in Python with librosa, it is a single call (assuming the audio is already loaded): librosa.stft.
A streaming implementation requires a bit more care. You will then need tohandling the window function, the FFT operation on each window, and the overlapped extraction of the windows. Not very complicated, but a bit harder.
The primary benefit would be lower-latency and lower memory requirements. If these are not key requirements, I would recommend the clip-wise solution.