Intro 3.2. Configuring the spectrogram

With Spectrogram settings... from the Spectrogram menu, you can determine how the spectrogram is computed and how it is displayed. These settings will be remembered across Praat sessions. All these settings have standard values ("factory settings"), which appear when you click Standards.

View range (Hz)
  the range of frequencies to display. The standard is 0 Hz at the bottom and 5000 Hz at the top. If this maximum frequency is higher than the Nyquist frequency of the Sound (which is half its sampling frequency), some values in the spectrogram will be zero, and the higher frequencies will be drawn in white. You can see this if you record a Sound at 44100 Hz and set the view range from 0 Hz to 25000 Hz.
Window length
  the duration of the analysis window. If this is 0.005 seconds (the standard), Praat uses for each frame the part of the sound that lies between 0.0025 seconds before and 0.0025 seconds after the centre of that frame (for Gaussian windows, Praat actually uses a bit more than that). The window length determines the bandwidth of the spectral analysis, i.e. the width of the horizontal line in the spectrogram of a pure sine wave (see below). For a Gaussian window, the -3 dB bandwidth is 2*sqrt(6*ln(2))/(π*Window length), or 1.2982804 / Window length. To get a “broad-band” spectrogram (bandwidth 260 Hz), keep the standard window length of 5 ms; to get a “narrow-band” spectrogram (bandwidth 43 Hz), set it to 30 ms (0.03 seconds). The other window shapes give slightly different values.
Dynamic range (dB)
  All values that are more than Dynamic range dB below the maximum (perhaps after dynamic compression, see Advanced spectrogram settings...) will be drawn in white. Values in-between have appropriate shades of grey. Thus, if the highest peak in the spectrogram has a height of 30 dB/Hz, and the dynamic range is 50 dB (which is the standard value), then values below -20 dB/Hz will be drawn in white, and values between -20 dB/Hz and 30 dB/Hz will be drawn in various shades of grey.

## The bandwidth

To see how the window length influences the bandwidth, first create a 1000-Hz sine wave with Create Sound from formula... by typing `1/2 * sin (2*pi*1000*x)` as the formula, then click View & Edit. The spectrogram will show a horizontal black line. You can now vary the window length in the spectrogram settings and see how the thickness of the lines varies. The line gets thinner if you raise the window length. Apparently, if the analysis window comprises more periods of the wave, the spectrogram can tell us the frequency of the wave with greater precision.

To see this more precisely, create a sum of two sine waves, with frequencies of 1000 and 1200 Hz. the formula is `1/4 * sin (2*pi*1000*x) + 1/4 * sin (2*pi*1200*x)`. In the editor, you will see a single thick band if the analysis window is short (5 ms), and two separate bands if the analysis window is long (30 ms). Apparently, the frequency resolution gets better with longer analysis windows.

So why don't we always use long analysis windows? The answer is that their time resolution is poor. To see this, create a sound that consists of two sine waves and two short clicks. The formula is `0.02*(sin(2*pi*1000*x)+sin(2*pi*1200*x)) + (col=10000)+(col=10200)`. If you view this sound, you can see that the two clicks will overlap in time if the analysis window is long, and that the sine waves overlap in frequency if the analysis window is short. Apparently, there is a trade-off between time resolution and frequency resolution. One cannot know both the time and the frequency with great precision.

## Advanced settings

The Spectrogram menu also contains Advanced spectrogram settings....

### Links to this page

- Intro
- Intro 3. Spectral analysis
- Intro 3.7. Configuring the spectral slice