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.

  • $\begingroup$ It is not an implementation issue; as-you-go approach parallelizes data acquisition and processing and cuts a delay in arriving at a clip identification decision. $\endgroup$ – V.V.T Aug 5 at 3:16
  • $\begingroup$ @V.V.T Thanks, that's good information! However, it is certainly an implementation issue for me, as I have to program the software, and speed is not the highest concern. Ease of implementation is! Once I've got something working, I can think (if I have time) about parallel operations :) $\endgroup$ – rocksNwaves Aug 5 at 16:55

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.