1

I take a song sample and perform the FFT (fast Fourier transformation) on the sample. I am able to get the frequencies of the song, but I am not able to get the time at which those frequencies occur. So, it basically becomes useless as I have to match it with different sample unless I get the information of time out of it.

How do I proceed?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
sumit
  • 97
  • 3
  • 9
  • Not sure if you've found your answer or not but I have recently come across an open-source sound api library called 'musicg'. It's rather simple, but obviously you will lose some of the freedom of making everything yourself. I've had a few good tests with it though. – While-E Jul 04 '12 at 14:59

2 Answers2

5

You need to break up the sample into multiple smaller timeslices, and FFT each slice. Each FFT result gives you the average frequency content over that slice of time. This is commonly called a Spectrogram

Tim
  • 35,413
  • 11
  • 95
  • 121
3

The answer to your question involves a time frequency trade-off you will have to decide on. The smaller slice of time you analyze to get a smaller time uncertainty window, the coarser the frequency accuracy. And vice-versa. If you want an exact frequency, then time window required and thus the time uncertainty could become infinitely large.

If you know what frequency band and bandwidth in which you are interested, you could try filtering out that band and looking at the amplitude envelope which might have a starting rise and falling decay. If you know the exact shape of the envelope of the sound of interest, then convolution against a matched filter might give you a peak correlation point in time.

hotpaw2
  • 70,107
  • 14
  • 90
  • 153