
A command that creates a Spectrogram from every selected Sound object. It performs a shortterm spectral analysis, which means that for a number of time points in the Sound, Praat computes an approximation of the spectrum at that time. Each such spectrum is called an analysis frame.
For tutorial information, see Intro 3. Spectral analysis.
For purposes of computation speed, Praat may decide to change the time step and the frequency step. This is because the time step never needs to be smaller than 1/(8√π) of the window length, and the frequency step never needs to be smaller than (√π)/8 of the inverse of the window length. For instance, if the window length is 29 ms, the actual time step will never be less than 29/(8√π) = 2.045 ms. And if the window length is 5 ms, the actual frequency step will never be less than (√π)/8/0.005 = 44.31 Hz.
You can check the bandwidth formula with the following procedure:
! create a 1000Hz sine wave, windowed by a 0.2seconds Gaussian window.
Create Sound from formula: "gauss", 1, 0.0, 1.0, 44100, "sin(2*pi*1000*x) * exp(3*((x0.5)/0.1)^2)"
! compute its spectrum and look at its bandwidth
To Spectrum: "yes"
Draw: 980, 1020, 20, 80, "yes"
Marks bottom every: 1, 2, "yes", "yes", "yes"
Marks left every: 1, 2, "yes", "yes", "yes"
! now you should see a peak at 1000 Hz with a 3 dB bandwidth of 7 Hz (20 dB: 17 Hz)
! more precise: compute the position and width of the peak, and write them to the console
Formula: ~ if x<980 or x>1020 then 0 else self fi
To Formant (peaks): 20
List: "no", "yes", 6, "no", 3, "yes", 3, "yes"
! now you should be able to read that a peak was found at 999.99982 Hz
! with a bandwidth of 6.497 Hz; the theory above predicted 6.491 Hz
! The same, windowed by a 0.1seconds Hamming window.
Create Sound from formula: "Hamming", 1, 0.0, 1.0, 44100, ~ if x<0.4 or x>0.6 then 0 else sin(2*pi*1000*x)*(0.54+0.46*cos(pi*(x0.5)/0.1)) fi
To Spectrum: "yes"
Formula: ~ if x<970 or x>1030 then 0 else self fi
To Formant (peaks): 20
List: "no", "yes", 6, "no", 3, "yes", 3, "yes"
! peak at 999.99817 Hz, 3 dB bw 6.518 Hz, 20 dB bw 15 Hz, zero bw 20 Hz, sidelobe 42 dB
! The same, windowed by a 0.1seconds rectangular window.
Create Sound from formula: "rectangular", 1, 0.0, 1.0, 44100, ~ if x<0.4 or x>0.6 then 0 else sin(2*pi*1000*x) fi
To Spectrum: "yes"
Formula: ~ if x<970 or x>1030 then 0 else self fi
To Formant (peaks): 20
List: "no", "yes", 6, "no", 3, "yes", 3, "yes"
! peak at 999.99506 Hz, 3 dB bw 4.440 Hz, 20 dB bw 27 Hz, zero bw 10 Hz, sidelobe 14 dB
! The same, windowed by a 0.1seconds Hanning window.
Create Sound from formula: "Hanning", 1, 0.0, 1.0, 44100, ~ if x<0.4 or x>0.6 then 0 else sin(2*pi*1000*x)*(0.5+0.5*cos(pi*(x0.5)/0.1)) fi
To Spectrum: "yes"
Formula: ~ if x<970 or x>1030 then 0 else self fi
To Formant (peaks): 20
List: "no", "yes", 6, "no", 3, "yes", 3, "yes"
! peak at 999.99945 Hz, 3 dB bw 7.212 Hz, 20 dB bw 16 Hz, zero bw 20 Hz, sidelobe 31 dB
! The same, windowed by a 0.1seconds triangular window.
Create Sound from formula: "triangular", 1, 0.0, 1.0, 44100, ~ if x<0.4 or x>0.6 then 0 else sin(2*pi*1000*x)*(1abs((x0.5)/0.1)) fi
To Spectrum: "yes"
Formula: ~ if x<970 or x>1030 then 0 else self fi
To Formant (peaks): 20
List: "no", "yes", 6, "no", 3, "yes", 3, "yes"
! peak at 999.99933 Hz, 3 dB bw 6.384 Hz, 20 dB bw 15 Hz, zero bw 20 Hz, sidelobe 26 dB
! The same, windowed by a 0.1seconds parabolic window.
Create Sound from formula: "parabolic", 1, 0.0, 1.0, 44100, ~ if x<0.4 or x>0.6 then 0 else sin(2*pi*1000*x)*(1((x0.5)/0.1)^2) fi
To Spectrum: "yes"
Formula: ~ if x<970 or x>1030 then 0 else self fi
To Formant (peaks): 20
List: "no", "yes", 6, "no", 3, "yes", 3, "yes"
! peak at 999.99921 Hz, 3 dB bw 5.786 Hz, 20 dB bw 12 Hz, zero bw 15 Hz, sidelobe 21 dB
© ppgb 20211015