Spectrum & Envelope Lab

A focused Praat laboratory for understanding measured frequency spectra, validated harmonic peaks, spectral envelopes, and the effects of analysis-window length.

AnalysisVersion 1.0.4 (2026)Pure Praat · OfflineAuthor: Shai CohenBar-Ilan University · Department of Music

Overview

Spectrum & Envelope Lab turns a selected Praat Sound into a comparative spectrum-reading exercise. It overlays measured spectral structure, predicted harmonic positions, validated peaks, and two different envelope estimates. You can analyze one window, compare two regions of the same recording, compare two recordings, or examine the consequences of changing the FFT analysis-window length.

The aim is interpretation rather than processing. No new sound is synthesized or modified. The script generates an 8 × 8 Praat Picture, reports findings in the Info window, and optionally retains a compact results Table.

What makes it different from other Analysis scripts? This lab examines why spectral curves and envelopes look as they do. For broad descriptor extraction, brightness classification, spectrograms or MFCC analysis, use the dedicated AudioTools scripts instead.

Select Sound(s)→Choose mode & windows→Analyze→Read Picture & Info→Compare or teach

Quick start

  1. Open a recording in Praat and select its Sound object. To compare different recordings, select exactly two Sound objects.
  2. Choose AudioTools - Analysis → Spectrum_Envelope_Lab… from the Praat Objects window, or run Spectrum_Envelope_Lab.praat directly.
  3. Choose A, B, C or D under Analysis mode. The number of selected Sounds must match the mode.
  4. For a first experiment, select A. Single spectrum / envelope and leave both Window A fields at 0. The script analyzes the entire selected Sound, subject to its FFT-size limit.
  5. Leave Spectrum display at “Spectrum plus harmonic markers” and Envelope at “Both envelopes” to inspect measured peaks and envelope differences. For material with no reliable F0, the continuous spectrum and cepstral envelope can still be informative.
  6. Run the script. Inspect the Praat Picture and the Info-window findings. Enable Create results table only if numerical values are needed afterward.

Tip: choose a sustained, nearly stationary musical tone for the first run. Then compare its attack with its middle or decay in mode B.

Four analysis modes

Mode A · One Sound

Single spectrum / envelope

Inspect one time window (or the full recording) as a measured spectrum, optionally with harmonic evidence and one or both envelopes. Useful for distinguishing spectral peaks from the smoothed shape around them.

Mode B · One Sound

Compare two windows

Compare two specified intervals on the same axes. When both window durations are 0, the script automatically chooses 100 ms near a detected onset and 100 ms near the middle; it requires at least 0.3 s of audio.

Mode C · Two Sounds

Compare two recordings

Use Window A in Sound A and Window B in Sound B; both recordings may have different durations and sampling rates. Sound A corresponds to the first selected Sound in Praat's Objects ordering. Absolute and peak-normalized views answer different questions.

Mode D · One Sound

FFT window laboratory

Compare 10, 40, 160 and 640 ms Hann windows at a shared centre time. Only windows that fit in the recording are used (at least two are required). A measured −6 dB peak width is reported only when sufficient evidence permits it.

Window coordinates: start times are measured in seconds from the beginning of the corresponding Sound, not from Praat's absolute object start time. A window duration of 0 means “continue to the end” in modes A and C. Mode B interprets both durations at 0 as its automatic attack/middle comparison. Mode D uses the centre of Window A when a duration is given, otherwise the Sound midpoint.

How to read the Praat Picture

Upper panel: measured spectrum

The continuous curve shows calibrated spectral amplitude versus frequency. In harmonic display modes, small marks distinguish a measured peak that passed validation from the expected position of a harmonic (k × F0). Missing validations are not filled in. When “Verified harmonic peaks” is selected but no peaks validate, the measured spectrum appears in subdued grey with an explanatory message rather than as an empty plot.

Lower panel: envelopes or frequency zoom

When an envelope is selected, the second panel shows the spectrum as faint context and overlays the requested envelope estimates. The peak-derived envelope connects validated harmonic peaks (without extrapolating into unsupported regions). The cepstral envelope is Praat's cepstrally smoothed estimate, which follows a different definition and need not pass through the peak heights.

In mode D, the second panel instead zooms into the selected spectral region to examine how window length affects peak width. If the frequency band is too narrow or the reference peak is unsuitable, the script reports that it cannot make a reliable width measurement.

Absolute level versus peak-normalized shape

DisplayReferenceInterpretation
AbsoluteSine-calibrated dBFSPreserves differences in the plotted spectral-component levels. The values are not calibrated acoustic pressure or dB SPL.
Peak-normalized shapeEach analyzed window's own maximum = 0 dBHighlights spectral shape but deliberately removes the overall offset between windows. Do not use it to infer which recording is louder.

The panel titles, legends and findings strip identify the analysis mode, the selected frequency band, F0 availability, and whether an optional cepstral display alignment has been applied.

Parameters

ControlDefaultWhat it does
Analysis modeA. Single spectrum / envelopeSelects one of the four workflows explained above.
Window A start / duration0 s / 0 sDefines the main interval; 0 duration generally means the rest of the recording. In D, an explicit interval selects the centre of the laboratory windows.
Window B start / duration0 s / 0 sDefines the second interval in B or C. B with both durations 0 triggers its automatic attack/middle mode.
Spectrum displaySpectrum plus harmonic markersContinuous spectrum, validated harmonic peaks, or continuous spectrum with markers.
EnvelopeBoth envelopesNone, peak-derived, cepstral, or both. The lab's FFT mode uses its own window-length comparison.
Level scaleAbsolute (sine-calibrated dBFS)Choose a common level reference or independently normalized curve shapes.
Fundamental frequency0 Hz (auto)Use window-local Praat Pitch estimation; a positive value fixes the reference F0 instead. A supplied F0 is not proof of an actual harmonic source.
Cepstral smoothing300 HzSets the smoothing parameter for the cepstral envelope.
Minimum / maximum frequency0 / 8,000 HzMinimum changes only the displayed range. Analysis uses approximately 20 Hz to the effective maximum, limited to 98% of the lowest Nyquist frequency.
Dynamic range70 dBControls the vertical span of the visual display (accepted range: 20–150 dB).
Draw visualizationOnCreates the Praat Picture with measured curves, labels and findings.
Create results tableOffRetains one row per analyzed window with measured values and methodological metadata.
Advanced settingsOffOpens a second dialog for pitch range, harmonic-peak validation criteria and optional cepstral display alignment.
Advanced settings and their initial values

Pitch floor: 50 Hz; Pitch ceiling: 1,500 Hz; Peak prominence: 6 dB; Floor margin: 15 dB; Harmonic tolerance: 0.2 × F0; Align cepstral display: off.

These are thresholds for analysis and visualization, not a promise that every detected peak represents one physical partial. The optional cepstral alignment shifts the curve only for display and is identified as such.

Teaching applications

Exercise 1

Measured peak versus expected harmonic

Load a sustained periodic tone. Display the spectrum with harmonic markers. Ask students to identify which k × F0 positions contain validated peaks and which do not. Then compare a metallic or noise-rich source without assuming every peak is harmonic.

Exercise 2

Envelope is an estimate

In mode A, select “Both envelopes” and vary cepstral smoothing. Which broad features persist? Which peaks disappear? Discuss why the peak-connecting envelope and the log-spectral cepstral estimate are not interchangeable.

Exercise 3

Attack versus middle

Use mode B with a plucked or struck note. Start with automatic windows, then set your own intervals. Compare the spectral shape, peak validation and envelope change, noting when the attack is insufficiently stationary for harmonic interpretation.

Exercise 4

Resolution versus time

Run mode D on a relatively stable tone. Compare 10, 40, 160 and 640 ms windows where available. Relate the changing peak widths to roughly 1/T and discuss why a longer window can conceal rapid temporal change.

Discussion prompt: “What did the analysis measure directly, what was estimated by an algorithm, and what remains a perceptual or physical hypothesis?”

Methodology and interpretation limits

Windowing, FFT and level units

Each analyzed interval is Hann-windowed before conversion to a spectrum. Praat's zero padding gives a denser frequency grid for locating peaks; it does not create extra resolving power. As a useful classroom approximation for an isolated Hann-windowed sinusoid, the −3 dB main-lobe width is about 1.44/T Hz and the −6 dB width about 2/T Hz, where T is the duration in seconds.

The displayed amplitude is calibrated against a sinusoid's digital amplitude. It is not sound-pressure level, a broadband power spectrum, or power spectral density; comparisons involving broadband noise require particular care.

Fundamental frequency and harmonic validation

An automatic F0 is based on the median of the selected window's Praat Pitch track and accepted only if enough frames are voiced and sufficiently stable. The code may refine that estimate from validated peaks, and in a restricted even-harmonics case may propose an octave correction. Harmonic validation checks for actual local peaks near theoretical multiples of F0; predicted positions and measured peaks are never equivalent by definition.

The status consistent is a heuristic agreement with a harmonic grid, not proof that the sound comes from a single harmonic source. Inconclusive and not found indicate weaker or absent evidence under the current settings; an unresolved analysis may simply have too short a window to separate the lower harmonics. Speech, bells, polyphony, unstable tones and noise can legitimately yield incomplete results.

Envelope methods and boundaries

The peak-derived envelope is a linear connection of validated harmonic peaks only and is not extrapolated outside them. The cepstral envelope uses Praat's cepstral smoothing of the spectrum. Because smoothing averages structure in a different way, the cepstral curve can sit below the harmonic peaks; that gap is not automatically a measurement error. Neither method alone is a measured formant track.

Limits and safeguards

Outputs and integration

OutputContentsPersistence
Praat Picture8 × 8 composition with metadata, one or two measured panels, legends, findings and a pedagogical cue.Drawn when visualization is enabled.
Info windowSelected source/channel, window durations, FFT bin spacing, F0 status, harmonic validation and contextual interpretation.Text report from the current run.
Table Spectrum_Envelope_LabOne row per window: frequency/level data, F0 source, validated harmonic counts, analysis settings and mode-D peak-width status where applicable.Created only when the Table option is enabled.

Plugin placement: save the script as plugin_AudioTools/Analysis/Spectrum_Envelope_Lab.praat. AudioTools' setup.praat automatically discovers .praat files in the category folders, so the script requires no custom menu registration. The web help file belongs at /sha/praat/scripts/Spectrum_Envelope_Lab.html.

Related tools: Acoustic Pedagogy (synthetic demonstrations), Audio Descriptions and Global Statistics (descriptors), CWT Scalogram (time–frequency analysis) and Multi-Layer Audio Visualizer (multi-track overview).

Troubleshooting

Why are harmonic markers or the peak-derived envelope missing?

F0 may be unavailable or unstable; the window may be too short to separate lower harmonics; or too few measured peaks may meet the validation rules. Try a sustained tone, a longer window, or a carefully chosen positive F0. Do not interpret “no validated peaks” as “no spectral energy.”

Why are my two spectra on different apparent levels?

Absolute mode keeps the calibrated component levels. For a shape-only comparison, use “Peak-normalized shape”, which places the maximum of each window at 0 dB. The two modes answer different questions.

Why does the script reject a long recording?

The selected analysis interval exceeds the 2^21-sample FFT safety limit. Enter a shorter Window A or B interval rather than using duration 0 for the entire recording.

Why are fewer than four windows shown in the FFT laboratory?

Only windows of 10, 40, 160 and 640 ms that fit around the chosen centre are used. At least two must fit; otherwise the script asks for another centre or a longer recording.

Why is there no reliable −6 dB width measurement?

The displayed frequency range may be too narrow, the strongest apparent peak may be near an edge or insufficiently prominent, or the peak may not be isolated enough for a single-main-lobe interpretation. The window-length comparison remains educational even without that width value.

↑ Back to top