Queries

Phonometrica offers a number of features to search through annotated corpora and extract acoustic measurements. Query features are available in the Analysis menu.

Text queries

To run a new text query, click on Analysis > Find in annotations... or use the shortcut Ctrl+Shift+F. This opens the query editor, which lets you search through all the annotations in your corpus.

The Files box

The Files box allows you to select which annotation files to search in. You can select files individually to restrict your query, or leave all files unchecked to search in all annotation files.

Metadata filters

If your project has properties, a set of filter controls appears below the search area. Each property category is displayed as a group of checkboxes. The search engine filters files based on the conditions you specify:

  • Within a category, Phonometrica uses the Boolean OR operator: a file matches if it has any of the checked labels.

  • Across categories, Phonometrica uses the Boolean AND operator: a file must match all categories.

An additional field at the bottom allows you to filter files based on their description (including or excluding files that contain a specific string).

Saving and editing queries

You can save a query for later reuse using the Save or Save as... buttons in the query editor. Saved queries are stored as .phon-query files and appear in the project tree. To re-run or modify a saved query, use Analysis > Edit last query... (Ctrl+L) or double-click on the query in the project tree.

Complex queries

A simple query searches for a pattern in one event (interval or instant) at a time. Sometimes, however, you need to match text in several events simultaneously — for instance, to find a word on one layer that is aligned with a particular part-of-speech tag on another layer. This is called a complex query.

Building a complex query

Below the main search field, two buttons (+ and -) allow you to add and remove search constraints. Any query with more than one constraint is a complex query.

When you add one or more constraints, each constraint (except the last) is followed by a selector that specifies the relation between the current constraint and the next one. Phonometrica supports the following relations:

Alignment

Two events are aligned if they are on different layers and their left and right boundaries coincide.

Example: to extract all nouns from a corpus with a word layer (layer 1) and a POS layer (layer 2) that is aligned with the word layer: set NOUN as the search pattern for layer 1, choose is aligned with, set .+ as the pattern for layer 2, and choose layer 2 as the display layer. Phonometrica will return the words on layer 2 that are exactly aligned with a NOUN item on layer 1.

Left alignment

Two events are left-aligned if they share their left boundary (start time) but not necessarily their right boundary. This is useful for hierarchical structures where a larger unit starts at the same point as a smaller unit.

Right alignment

Two events are right-aligned if they share their right boundary (end time). This is the mirror of left alignment.

Dominance

An event a dominates an event b if a and b are on different layers, the left boundary of b is greater than or equal to that of a, and the right boundary of b is less than or equal to that of a. Dominance relations encode hierarchical structures — for instance, a word dominating the syllables it contains.

Strict dominance

Strict dominance is like dominance, but requires that the boundaries are strictly contained: the dominated event’s boundaries must fall strictly within those of the dominating event (not coinciding with either boundary). This is useful when you want to exclude cases where the inner event spans the entire outer event.

Precedence (precedes)

Two events are in a precedence relation if the first one immediately precedes the second on the same layer (i.e. the end time of the first event equals the start time of the second). You can chain multiple constraints with this relation to search for sequences of events.

Example: to find all DET + NOUN sequences on a POS layer (layer 1), with the result displayed from a word layer (layer 2): set DET for the first constraint on layer 1, choose precedes, and set NOUN for the second constraint on layer 1. The display layer should be set to layer 2. Phonometrica will return the concatenated words from layer 2 that span the matched sequence on layer 1.

Subsequence (follows)

The follows relation is the reverse of precedence: the first event immediately follows the second.

Display layer

Complex queries do not use the KWIC model. Instead, you choose a display layer at the top of the search editor. The text displayed in the result is the concatenation of all events on the display layer within the time span defined by the matched constraints.

Acoustic queries

In addition to text queries, Phonometrica can extract acoustic measurements from your corpus. Acoustic queries combine the text search infrastructure (constraints, metadata filters, file selection) with acoustic analysis algorithms. The results are displayed in a concordance view with additional measurement columns.

All acoustic queries require that the annotation files being searched are bound to sound files.

Measurement points

Formant, pitch, intensity and spectral moments queries share a Measurement setting, which decides where in each matched event the measurements are taken:

  • Midpoint: a single measurement at the temporal midpoint of the event.

  • N-point (%): one measurement at each of the percentages you list, separated by spaces (e.g. 25 50 75 measures at a quarter, half and three quarters of the event’s duration). Every match has the same number of points, so the results can be shown in wide format (one row per match, one group of columns per point, with an optional average of the points) or in long format (one row per point). You choose the format in the query editor and can switch between the two later from the concordance’s Display settings menu.

  • Every (ms): measurements at a fixed interval, set in milliseconds (5 ms by default). Longer events get more points than shorter ones, so the number of points varies from one match to the next: the results are always in long format, and the wide/long toggle is not available for these concordances.

With Every (ms), the points are spaced by exactly the step you set and centred in the event: an event of duration d gets d / step points (rounded down), and the first and last points are at least half a step away from the event’s boundaries. For instance, a 102 ms vowel measured every 10 ms gets 10 points, the first one 6 ms after the start of the vowel and the last one 6 ms before its end. An event shorter than one step gets a single point, at its midpoint, so that no match disappears from the results. This step is unrelated to the Time step setting of pitch and intensity analysis, which is the resolution of the analysis itself.

In long format, each row describes one point and starts with three columns:

  • Step: the number of the point within its match, starting at 1.

  • Time (normalized): the position of the point in the event, from 0 (start) to 1 (end).

  • Time: the absolute time of the point in seconds, when Add measurement time is checked.

They are followed by the measurements at that point. Values that apply to the whole match, such as the LPC parameters chosen by automatic formant analysis or the parameters set by a per-property override, are repeated on every row of the match.

Formant queries

To run a formant query, click on Analysis > Measure formants.... The formant query editor extends the text query editor with a panel for formant analysis settings:

  • Number of formants: the maximum number of formants to extract (typically 3 or 4).

  • Maximum frequency: the highest frequency below which formants are expected (e.g. 5000 Hz for male voices, 5500 Hz for female voices).

  • Window length: the duration of the LPC analysis window (in seconds).

  • LPC order: the number of prediction coefficients. By default, Phonometrica uses 2 × number of formants + 2.

Formant values are measured at the midpoint of the matched event, at n points given as percentages of its duration, or every n milliseconds (see Measurement points).

Automatic parameter selection. The analysis settings that suit a token depend on the speaker and on the vowel, and a wrong maximum frequency typically makes LPC merge two formants or split one. In Semi-parametric (automatic) mode, Phonometrica analyses each match with a range of settings and keeps the best analysis. The settings are chosen once for each match, over the whole event, and all the measurement points of the match use them. The selected Max freq and LPC order are added to the concordance for each match.

Phonometrica selects the settings with a reimplementation of Santiago Barreda’s Fast Track method [BAR2021]. The event is analysed with Burg’s method (5.5 formants, i.e. LPC order 11, frames every 2 ms) at several maximum frequencies evenly spaced over the range: Steps sets how many. In each analysis, the track of each formant is fitted with a smooth curve, a constant plus Coefficients cosine terms, and the analysis whose tracks stay closest to their smooth curves (the smallest sum, over formants, of the mean absolute deviation in Hz) wins. As in Fast Track, analyses that are implausible are ruled out: an F3 below 2000 Hz when F1 and F2 are less than 500 Hz apart and, when 4 formants are measured, an F4 below 2900 Hz or within 500 Hz of F3 while F1 and F2 are less than 1500 Hz apart. The selection uses the first 3 formants, or 4 if you measure 4 or more.

The Range menu fills in the range of maximum frequencies with Barreda’s recommendations: 4500–6500 Hz for speakers taller than 5’8” (173 cm), 5000–7000 Hz between 5’0” and 5’8” (152–173 cm), and 5500–7500 Hz for shorter speakers and children. The default is the middle range, 5000–7000 Hz. Values chooses what is measured: Smooth tracks (the default, as in Fast Track) reads the formants from the fitted curves of the winning analysis, while Raw LPC values measures them with the winning maximum frequency. Bandwidths are always raw LPC values. Frames are placed from the start to the end of the event, as Fast Track does on vowels extracted with its default 25 ms buffer.

Note

Choosing the range of maximum frequencies

The range is the setting that matters most for the quality of the results, and a wider range is not safer. It must include the right analysis for each token, but it should exclude analyses that are badly wrong: with a maximum frequency much too low or much too high for a voice, LPC can produce formant tracks that are perfectly smooth, and that look like another vowel produced by another type of speaker. Since Fast Track judges analyses by their smoothness, it cannot tell such an analysis from the right one. Barreda (2021) warns that “maximum-formant settings that are very inappropriate for a given sound can result in analyses that are extremely inaccurate, and yet very difficult to distinguish from a good formant-track”. In his evaluation on the vowels of Hillenbrand et al. (1995), using one range for adult men (4800–6600 Hz) and another for the other speakers (5500–7300 Hz), instead of 4800–7300 Hz for everyone, substantially reduced the errors [BAR2021].

Barreda’s advice, from the paper and from the Fast Track wiki:

  • Choose the range from the speaker’s size, which determines the length of the vocal tract, using the presets of the Range menu. They correspond roughly to adult men, adult women (and teenagers), and children, but it is height rather than sex that matters: men and women of the same height need about the same range. There is a lot of variation within each group, so individual voices may need adjustments.

  • When a corpus contains different types of speakers, do not use one wide range for all of them. Give each group, or each speaker if you have enough tokens per speaker, its own range with Adjust maximum frequency by property (for instance with a property recording the speaker’s sex, height or name).

  • Check the results speaker by speaker. The Max freq column of the concordance shows the maximum frequency selected for each match. If wrong measurements often come with the lowest maximum frequencies of the range, the range should be raised; if they often come with the highest ones, it should be lowered.

    Phonometrica helps with this check: after a Fast Track query, it lists the files (assuming one speaker per file) in which at least 5 matches were measured and at least a quarter of them got the lowest, or the highest, maximum frequency of their range. Such a pile-up suggests that the range does not suit the speaker. Look at these matches: if their formants are wrong, the range reaches too far in that direction and should be moved away from it; if they look right, the best value may lie beyond the range, which should be extended in that direction.

  • High front vowels, whose F3 and F4 are high, tend to need higher maximum frequencies than other vowels.

Studies that use Fast Track typically report Barreda’s ranges by sex (4500–6500 Hz for men and 5000–7000 Hz for women) or the ranges of his paper (4800–6600 Hz for men), with the tracks checked and the range adjusted for individual speakers when needed.

When parameter overrides by property are enabled (for instance by speaker gender), the range of maximum frequencies can be set separately for each level of the property, which is how Fast Track is meant to be used when speakers differ in size.

Optionally, you can include bandwidth columns in the output. Formant values stored in Hertz can be converted to ERB or Bark scales on the fly using the Scales menu in the concordance toolbar (see Concordances).

Pitch queries

To run a pitch query, click on Analysis > Measure pitch.... The pitch query editor adds a panel for pitch analysis settings:

  • Algorithm: Phonometrica supports five pitch tracking algorithms: Praat (raw autocorrelation) [BOE1993] (the default), Harvest [MOR2017], RAPT [TAL1995], REAPER [TAL2014], and SWIPE [CAM2007]. Harvest, RAPT, REAPER and SWIPE are provided by the Speech Signal Processing Toolkit (SPTK); Praat is a dedicated port of the algorithm used by the eponymous program. See Sound visualization and analysis for references. The Praat algorithm is also the engine used internally for voice quality analysis (see Voice report), so F0 and jitter/shimmer measurements on the same interval are always derived from a single, consistent set of voicing decisions.

  • Minimum pitch and Maximum pitch: the expected pitch range.

  • Voicing threshold: sensitivity to voicing detection. The valid range and default value depend on the selected algorithm (for example, 0.0–1.0 with default 0.45 for Praat, 0.2–0.5 with default 0.3 for SWIPE, −0.5–1.6 with default 0.9 for REAPER); the editor updates the default automatically when you change algorithm.

  • Time step: determines the temporal resolution of the pitch track.

When Praat is selected, four additional parameters are revealed, corresponding to Praat’s To Pitch (ac) command:

  • Silence threshold (default 0.03): frames below this relative amplitude are treated as silent.

  • Octave cost (default 0.01): favors higher-frequency candidates during path selection.

  • Octave-jump cost (default 0.35): penalty for an octave jump between adjacent frames.

  • Voiced/unvoiced cost (default 0.14): penalty for a voiced↔unvoiced transition.

Like formant queries, pitch can be measured at the midpoint, at n points, or every n milliseconds (see Measurement points). Pitch values in Hertz can be converted to semitones (relative to a reference) or to ERB rate via the Scales menu.

Intensity queries

To run an intensity query, click on Analysis > Measure intensity.... The intensity query editor adds settings for:

  • Minimum intensity and Maximum intensity: the expected intensity range.

  • Time step: the temporal resolution of the intensity contour.

Intensity can be measured at the midpoint, at n points, or every n milliseconds (see Measurement points).

Spectral moments queries

Spectral moments characterize the shape of the spectral distribution and are widely used in phonetics for the analysis of fricatives and other obstruents. To run a spectral moments query, click on Analysis > Measure spectral moments....

Phonometrica computes four spectral moments from the power spectrum, treating the spectrum as a probability distribution over frequency:

  • Centre of gravity (COG, 1st moment): the mean frequency, weighted by spectral power.

  • Spread (2nd moment): the standard deviation of the distribution, reflecting how dispersed the energy is around the COG.

  • Skewness (3rd moment): the asymmetry of the distribution. Positive skewness indicates more energy below the COG; negative skewness indicates more energy above it.

  • Kurtosis (4th moment, excess): the peakedness of the distribution relative to a Gaussian. Positive kurtosis indicates a sharper spectral peak; negative kurtosis indicates a flatter distribution.

The spectral moments query editor extends the text query editor with a panel for analysis settings:

  • Window duration: the length of the analysis window (in seconds). The default is 25 ms, which is typical for fricative analysis.

  • Window type: the shape of the window function applied before the FFT (Gaussian by default).

  • Min frequency and Max frequency: the frequency range over which the moments are computed. By default, the full range from 0 Hz to the Nyquist frequency is used. You can restrict the range to focus on a particular spectral region (e.g. 1000–11025 Hz to exclude low-frequency voicing energy).

  • Pre-emphasis: a 6 dB/octave high-pass filter that compensates for the spectral tilt of voiced sounds. Enabled by default with a threshold of 50 Hz.

  • Output: checkboxes let you select which of the four moments to include in the concordance. All four are enabled by default.

Like other acoustic queries, spectral moments can be measured at the midpoint of the matched event, at n points given as percentages, or every n milliseconds (see Measurement points).

Voice quality queries

Voice quality measures characterise glottal-source perturbation and noise — jitter (period perturbation), shimmer (amplitude perturbation), and harmonics-to-noise ratio. They are widely used in phoniatric and clinical work as well as in studies of voice register, breathiness, and creak. To run a voice quality query, click on Analysis > Measure voice quality....

The kernel is the same one that powers the interactive Voice report (F9 in the sound view) and the get_voice_report() scripting function — a single Praat-style autocorrelation pitch tracker [BOE1993] pass drives pulse derivation (Praat’s Sound & Pitch: To PointProcess (cc) algorithm), the jitter and shimmer families, the voicing fraction, mean F0, and HNR. Reported values match Praat’s “Voice report” for cross-checking. See Voice report for the definition of each measure and the filtering rules (out-of-range periods, 1.3× period-ratio cap, 1.6× amplitude- ratio cap for shimmer).

The voice quality query editor extends the text query editor with one analysis settings panel:

  • F0 range (default 75–600 Hz): bounds the pitch tracker’s periodicity search and the period filter applied to jitter and shimmer aggregates. Narrow the range for higher- or lower-pitched material.

  • Measurements: 15 checkboxes split into three logical columns — pulses, voicing and F0 (number of pulses, voicing fraction as a percentage, mean period in ms, mean F0 in Hz), jitter family (local, local absolute in µs, RAP, PPQ5, DDP, all as percentages except the absolute), and shimmer family + HNR (local, local in dB, APQ3, APQ5, APQ11, HNR in dB).

Two preset buttons sit below the grid:

  • Select essentials: checks the most commonly reported measures — Number of pulses, Voicing, Mean F0, Jitter local, Shimmer local, and HNR. This is the default when the dialog opens.

  • Select all: checks all 14 measures.

Unlike formant, pitch, intensity, and spectral moments queries, voice quality is always measured over the entire matched interval — there is no midpoint, n-point or fixed-step option. Jitter, shimmer, and HNR all require a span of samples wide enough to detect multiple glottal pulses; a single time-point makes no sense for these measures.

For the same reason, voice quality queries cannot measure instant annotations (targets where start_time == end_time). When a query produces one or more matches whose reference target is an instant, Phonometrica leaves the corresponding measurement cells blank and shows a single warning dialog after the search completes, reporting the number of skipped matches. The non-instant matches in the same batch are unaffected.

Each measurement is stored in the concordance in the same unit shown in the GUI Voice report (milliseconds for period, percent for the relative jitter and shimmer measures and voicing fraction, microseconds for absolute jitter, decibels for Shimmer (dB) and HNR, Hz for mean F0, and an integer for the pulse count), so a CSV export is immediately readable without per-column unit conversion. Column headers in the concordance mirror Praat’s naming: Pulses, Voicing(%), Period(ms), F0(Hz), Jitter(%), Jitter(µs), RAP(%), PPQ5(%), DDP(%), Shimmer(%), Shimmer(dB), APQ3(%), APQ5(%), APQ11(%), HNR(dB).

References

[BIR2001]

Bird, Steven & Mark Liberman. 2001. A Formal Framework for Linguistic Annotation. Speech Communication 33(1–2). 23–60.

[CAM2007]

Camacho, Arturo. 2007. SWIPE: A sawtooth waveform inspired pitch estimator for speech and music. PhD dissertation, University of Florida Gainesville.

[BOE1993] (1,2)

Boersma, Paul. 1993. Accurate short-term analysis of the fundamental frequency and the harmonics-to-noise ratio of a sampled sound. Proceedings of the Institute of Phonetic Sciences, University of Amsterdam 17. 97–110.

[MOR2017]

Morise, Masanori. 2017. Harvest: A high-performance fundamental frequency estimator from speech signals. Proceedings of INTERSPEECH 2017, 2321–2325.

[TAL1995]

Talkin, David. 1995. A robust algorithm for pitch tracking (RAPT). In W. B. Kleijn & K. K. Paliwal (eds.), Speech Coding and Synthesis, 495–518. Amsterdam: Elsevier.

[TAL2014]

Talkin, David. 2014. REAPER: Robust Epoch And Pitch EstimatoR. Software, Google. https://github.com/google/REAPER.

[BAR2021] (1,2)

Barreda, Santiago. 2021. Fast Track: fast (nearly) automatic formant-tracking using Praat. Linguistics Vanguard 7(1). https://doi.org/10.1515/lingvan-2020-0051. Software: https://github.com/santiagobarreda/FastTrack.

[WEE2015]

Weenink, David. 2015. Improved formant frequency measurements of short segments. Proceedings of the 18th International Congress of Phonetic Sciences. Glasgow: University of Glasgow.