When taking the STFT of an audio signal, the first axis is the frequency bins by convention, and the second axis is how it elapses through time. Is there a reason?

  • 7
    $\begingroup$ they're just semantics. you can call either the time axis or the frequency axis the "first axis". $\endgroup$ – robert bristow-johnson Jul 23 '17 at 5:24

It is really a matter of convention of the communities that use STFT. Medical devices tend to have time scrolling left to right or over writing left to right. For passive SONAR, most displays that Im familiar with have time water falling down and frequency increasing from left to right. There are exceptions as well. I've also seen amplitudes as marching mountains, color coded, and intensity coded as well. Much depends on the amount of time history that should be displayed and the time duration of signal events that are of interest. There are also perceptual consideration based on human vision that come into play and effect how STFT data is displayed. There are also places where an STFT display is the input to image processing algorithm.


The standard STFT allows the visualization in 2D of a 1D digital signal (an amplitude along some ordinal variable, often a time, but it can be a space distance) onto a couple of coordinates, one related to a windowed time frame ($\tau$), the other related to frequency ($\omega$):

$$X(\tau, \omega) = \int_{-\infty}^{\infty} x(t) w(t-\tau) e^{-j \omega t} \, dt $$

So one has to represent two orthogonal axes, and the natural choices are limited to two options: either horizontal, or vertical.

Very often, one juxtaposes the signal and the amplitude or the phase of the STFT, to better understand the non-stationary behaviors been studied. Therefore, it is natural to displayed the graphs along the same side.

In speech processing, signals are often displayed horizontally, so the time axis is often the horizontal one, as represented below.

speech signal and STFT

In seismic processing, signals are often displayed vertically, as the time extension is often related to the depth of events in the underground, so the time axis is often the vetical one, as represented below.

seismic signal and SFTFT

As the color representation of the amplitude of the STFT is not always easy to read, some representation are more 3D, with time and frequency mapped onto a vertical plane, and the amplitude unfolds in the third dimension.

3D spectrogram


For 2D spectrographs of music, some keyboard musicians prefer that the horizontal axis be log frequency, thus leaving time for the vertical axis. The resulting spectrograph then has a layout a bit like a piano roll.

Radio receivers (SDR or panadapters), commonly display a 2D spectrograph with the horizontal axis representing linear frequency, animated with a downward scroll (which means time increases upward). They thus fit under earlier radio frequency spectrum displays, which were laid-out similar to even older mechanical frequency scale tuning indicator displays.

Books on speech, hearing or audiology typically display spectrographs (2D or 3D projection) with time increasing left to right (at least for books written in left to right languages, such as English). Maybe to match the direction of linear text. Those spectrographs often have higher frequencies and/or magnitudes displayed vertically higher.


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.