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.
A focused Praat laboratory for understanding measured frequency spectra, validated harmonic peaks, spectral envelopes, and the effects of analysis-window length.
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.
Spectrum_Envelope_Lab.praat directly.0. The script analyzes the entire selected Sound, subject to its FFT-size limit.Tip: choose a sustained, nearly stationary musical tone for the first run. Then compare its attack with its middle or decay in mode B.
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.
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.
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.
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.
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.
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.
| Display | Reference | Interpretation |
|---|---|---|
| Absolute | Sine-calibrated dBFS | Preserves differences in the plotted spectral-component levels. The values are not calibrated acoustic pressure or dB SPL. |
| Peak-normalized shape | Each analyzed window's own maximum = 0 dB | Highlights 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.
| Control | Default | What it does |
|---|---|---|
| Analysis mode | A. Single spectrum / envelope | Selects one of the four workflows explained above. |
| Window A start / duration | 0 s / 0 s | Defines 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 / duration | 0 s / 0 s | Defines the second interval in B or C. B with both durations 0 triggers its automatic attack/middle mode. |
| Spectrum display | Spectrum plus harmonic markers | Continuous spectrum, validated harmonic peaks, or continuous spectrum with markers. |
| Envelope | Both envelopes | None, peak-derived, cepstral, or both. The lab's FFT mode uses its own window-length comparison. |
| Level scale | Absolute (sine-calibrated dBFS) | Choose a common level reference or independently normalized curve shapes. |
| Fundamental frequency | 0 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 smoothing | 300 Hz | Sets the smoothing parameter for the cepstral envelope. |
| Minimum / maximum frequency | 0 / 8,000 Hz | Minimum changes only the displayed range. Analysis uses approximately 20 Hz to the effective maximum, limited to 98% of the lowest Nyquist frequency. |
| Dynamic range | 70 dB | Controls the vertical span of the visual display (accepted range: 20–150 dB). |
| Draw visualization | On | Creates the Praat Picture with measured curves, labels and findings. |
| Create results table | Off | Retains one row per analyzed window with measured values and methodological metadata. |
| Advanced settings | Off | Opens a second dialog for pitch range, harmonic-peak validation criteria and optional cepstral display alignment. |
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.
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.
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.
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.
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?”
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.
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.
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.
2^21 input samples to bound FFT size. For long recordings, select a shorter interval instead of analyzing the full file.| Output | Contents | Persistence |
|---|---|---|
| Praat Picture | 8 × 8 composition with metadata, one or two measured panels, legends, findings and a pedagogical cue. | Drawn when visualization is enabled. |
| Info window | Selected source/channel, window durations, FFT bin spacing, F0 status, harmonic validation and contextual interpretation. | Text report from the current run. |
Table Spectrum_Envelope_Lab | One 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).
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.”
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.
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.
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.
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.