Author Topic: How are the spectrogram time stamps calculated?  (Read 5155 times)

jean-louis

  • Newbie
  • *
  • Posts: 19
    • View Profile
    • durrieu.ch
How are the spectrogram time stamps calculated?
« on: July 28, 2010, 07:06:41 »
Hi everyone,

I was wondering something, for some time now. In order to annotate some audio data, I display a layer of annotations ("a value at a time") on top of a spectrogram (computed using the built-in layer). The annotations I use have time stamps that correspond to the center of the analysis window. I noticed that sometimes there seems to be an offset between the stream of values (fundamental frequencies) and the displayed spectrogram. I however failed to find out how the time stamps were computed: do they correspond to the beginning of each frame, or to the center of the frames?

Cheers!

Jean-Louis

cannam

  • Administrator
  • Sr. Member
  • *****
  • Posts: 273
    • View Profile
Re: How are the spectrogram time stamps calculated?
« Reply #1 on: August 25, 2010, 20:56:22 »
Sorry to have taken so long to reply to this -- this is the sort of question that makes me really want to go back and review the behaviour of the program carefully, and take a look at the source code, and I'm afraid I haven't had time during the last month to do any of that having been somewhat swamped with other things.

In a 1024-point spectrogram with zero overlap, you should find that column N that is aligned with samples N*1024 to (N+1)*1024-1 in the audio waveform contains the data calculated from samples N*1024 and (N+1)*1024.

With overlap, the intention is to centre the displayed column on the centre sample of the source frame.  That is, given a 1024-point spectrogram with 50% overlap, the column N aligned with samples N*512 to (N+1)*512-1 should contain the data calculated from samples (N*512)-256 to (N+1)*512+255.


Chris

jean-louis

  • Newbie
  • *
  • Posts: 19
    • View Profile
    • durrieu.ch
Re: How are the spectrogram time stamps calculated?
« Reply #2 on: September 25, 2010, 15:23:27 »
Hi Chris,

Thanks for your answers. I might have some more questions about the time stamp returned by a plugin (first sample analyzed or middle of the frame?), but I need to get started with plugins and plugin development before I ask this sort of questions :D

Cheers !

Jean-Louis