Papers
Topics
Authors
Recent
Search
2000 character limit reached

Hamm-grams in Tonal Harmony

Updated 4 July 2026
  • Hamm-grams are harmony-oriented skip-grams that model tonal progressions by allowing bounded non-adjacent chord relations in polyphonic music.
  • They mitigate data sparsity by incorporating fixed- and variable-skip constraints, which boost train-test coverage and reveal hidden cadential patterns.
  • Evaluations on four Western classical datasets demonstrate substantial improvements in discovering conventional cadential progressions while balancing computational cost.

Hamm-grams are harmony-oriented skip-grams for modeling tonal progressions in polyphony: n-grams of symbolic chord events that relax strict contiguity by admitting bounded non-adjacent relations, so that underlying harmonic successions can still be represented when surface insertions such as non-chord tones, suspensions, and passing tones interrupt adjacency. In the reported formulation, Hamm-grams are used within viewpoint models of tonal harmony and were evaluated on four Western classical symbolic datasets, where they reduced sparsity in higher-order harmonic distributions, increased train-test coverage, and substantially improved discovery of conventional cadential progressions (Sears et al., 2017).

1. Conceptual basis and formal definition

In this usage, “grams” are n-grams of symbolic musical events. Given a sequence S=(e1,e2,,eT)S = (e_1, e_2, \dots, e_T) of events, a contiguous n-gram is any subsequence (ei,ei+1,,ei+n1)(e_i, e_{i+1}, \dots, e_{i+n-1}) with 1iTn+11 \le i \le T-n+1. For a corpus of CC pieces, where piece mm has sequence length kmk_m, the total number of contiguous n-gram tokens is m=1C(kmn+1)\sum_{m=1}^{C} (k_m - n + 1) (Sears et al., 2017).

Skip-grams generalize this construction by allowing bounded non-contiguous relations. An n-length skip-gram with max skip σ\sigma is any tuple (ei1,,ein)(e_{i_1}, \dots, e_{i_n}) with 1i1<<inT1 \le i_1 < \dots < i_n \le T and (ei,ei+1,,ei+n1)(e_i, e_{i+1}, \dots, e_{i+n-1})0 for all (ei,ei+1,,ei+n1)(e_i, e_{i+1}, \dots, e_{i+n-1})1. A variable-skip n-gram replaces the fixed skip bound with an inter-onset interval ceiling, so that adjacent elements in the tuple must satisfy an IOI bound such as (ei,ei+1,,ei+n1)(e_i, e_{i+1}, \dots, e_{i+n-1})2 s. This temporal variant reflects the fact that musical salience is not determined solely by event count but also by elapsed time (Sears et al., 2017).

The need for bounded skipping follows directly from combinatorial behavior in polyphonic corpora. Unbounded non-contiguity for a sequence of length (ei,ei+1,,ei+n1)(e_i, e_{i+1}, \dots, e_{i+n-1})3 yields (ei,ei+1,,ei+n1)(e_i, e_{i+1}, \dots, e_{i+n-1})4 possible tokens, and even a 20-event sequence contains 190 2-grams, 1140 3-grams, 4845 4-grams, and 15,504 5-grams if all non-contiguous relations are included. Hamm-grams therefore occupy a middle ground: they reject strict contiguity, but they also avoid the explosive token growth of unconstrained subsequence enumeration (Sears et al., 2017).

2. Harmonic event representation

The method operates on composite chord events encoded by viewpoint features that combine simultaneous relations and sequential relations. The practical typology used is the voice-leading type (VLT), in which each chord is represented by an ordered tuple (ei,ei+1,,ei+n1)(e_i, e_{i+1}, \dots, e_{i+n-1})5, where (ei,ei+1,,ei+n1)(e_i, e_{i+1}, \dots, e_{i+n-1})6 is a set of up to three interval classes above the bass and (ei,ei+1,,ei+n1)(e_i, e_{i+1}, \dots, e_{i+n-1})7 is the melodic interval class from the preceding bass to the current bass, both modulo the octave. Full expansion duplicates overlapping note events at each unique onset; in the reported corpus this yielded 327,150 chord onsets (Sears et al., 2017).

The vertical component of the representation is a major source of sparsity. Without reductions, (ei,ei+1,,ei+n1)(e_i, e_{i+1}, \dots, e_{i+n-1})8 alone has up to (ei,ei+1,,ei+n1)(e_i, e_{i+1}, \dots, e_{i+n-1})9 combinations, since each of three positions can take 13 values, including the undefined symbol 1iTn+11 \le i \le T-n+10. To control this, the study excludes pitch-class repetitions in 1iTn+11 \le i \le T-n+11 and allows permutations, reducing the domain to 233 unique VLTs when 1iTn+11 \le i \le T-n+12 and 1iTn+11 \le i \le T-n+13 is undefined. This reduction is important because higher-order harmonic sequences compound the state-space explosion already present at the level of single chord events (Sears et al., 2017).

Onsets with more than three vertical interval classes were handled by a three-step back-off strategy: closest maximal subset estimated from immediate context within 1iTn+11 \le i \le T-n+14 chords; most common maximal subset in the piece; and most common maximal subset in the corpus. This adjusted 5545 onsets, or 1.7% of the corpus, to respect the 1iTn+11 \le i \le T-n+15-interval constraint of the VLT representation. A plausible implication is that the representation trades some local chordal specificity for a tractable symbolic vocabulary suitable for distributional modeling (Sears et al., 2017).

3. Corpus, parameterization, and evaluation protocol

The empirical study used four Western classical symbolic datasets totaling over 20 hours of music. Each dataset included a score-like symbolic representation and aligned performance timing, either from sensor-equipped pianos or from ensemble recordings aligned at the downbeat level (Sears et al., 2017).

Dataset Pieces Chords / revised tokens
Haydn 50 73,704 / 0
Mozart 39 63,418 / 969
Beethoven 30 42,157 / 910
Chopin 156 147,871 / 3666
Total 275 327,150 chord onsets / 5545 revised

Contiguous n-grams were computed for 1iTn+11 \le i \le T-n+16. Sparsity analysis focused on 4-grams with fixed-skip settings up to 1, 2, 3, or 4 skips, and variable-skip settings with successive IOIs 1iTn+11 \le i \le T-n+17, 1iTn+11 \le i \le T-n+18, 1iTn+11 \le i \le T-n+19, or CC0 s. Coverage evaluations were conducted for CC1 under the same fixed and variable skip families (Sears et al., 2017).

The training/test regime used 10-fold cross-validation stratified by composer, with folds balanced to contain approximately equal compositions and total chord counts, within CC2 of the target per fold. Coverage was defined as

CC3

while the proportion of negligible counts under threshold CC4 was

CC5

The frequency and probability estimates were

CC6

Planned comparisons for coverage used Welch’s t-tests with backward difference coding and Bonferroni correction (Sears et al., 2017).

4. Sparsity reduction and coverage behavior

The central empirical claim is that Hamm-grams reduce data sparsity in n-gram distributions by minimizing the proportion of n-grams with negligible counts and by increasing the coverage of contiguous n-grams in a test corpus. For 4-grams, the contiguous model produced 135,331 types and 326,034 tokens. Fixed-skip variants increased this to 850,222, 2,364,840, 4,765,289, and 8,207,123 types for CC7, with corresponding token counts 2,604,972, 8,780,643, 20,786,976, and 40,548,000. Variable-skip variants were larger still, reaching 59,147,107 types and 718,717,231 tokens at IOI CC8 s (Sears et al., 2017).

The distributional interpretation is not merely a matter of larger vocabularies. Contiguous higher-order n-grams with CC9 deviated from a typical power-law profile because the proportion of types with negligible counts increased, producing more uniform distributions. Including skip-grams restored a power-law-like profile for 4-grams: cumulative probability curves showed fewer singletons and a heavier head. This suggests that bounded non-contiguity increases the recoverability of recurrent harmonic patterns rather than simply multiplying rare forms (Sears et al., 2017).

Coverage results were strongest for higher-order progressions. For 2-grams, mean coverage rose from 0.959 with no skip to 0.988 with fixed mm0 and to 0.993 with IOI mm1 s. For 3-grams, it rose from 0.707 to 0.901 with fixed mm2 and to 0.943 with IOI mm3 s. For 4-grams, the contiguous baseline of 0.365 increased to 0.711 with fixed mm4 and to 0.824 with IOI mm5 s. The paper summarizes this as drastic mitigation of the zero-frequency problem for higher-order harmony sequences (Sears et al., 2017).

5. Cadence discovery and music-theoretical significance

A major test case was cadence discovery. The study examined two conventional closing progressions: the semplice cadence, mm6, and the composta cadence, mm7, where mm8 is a six-four suspension over the cadential dominant. Discovery was counted as the number of pieces in which the exact four-chord VLT encodings were found (Sears et al., 2017).

Contiguous 4-grams performed poorly: the semplice cadence was discovered in 0 pieces and the composta cadence in 7. Fixed-skip models improved these counts monotonically, reaching 15 semplice and 63 composta discoveries at mm9. Variable-skip models also improved sharply, reaching 32 semplice and 77 composta discoveries at IOI kmk_m0 s. The difference is especially notable because cadential progressions are theoretically canonical yet are frequently obscured at the surface by suspensions, anticipations, and non-chord tones (Sears et al., 2017).

The explanation offered is directly music-theoretical. Cadences often contain interpolated events between structurally salient harmony events, so contiguous models encode the surface rather than the underlying harmonic trajectory. Hamm-grams recover non-adjacent dependencies such as kmk_m1 across suspensions, passing tones, or neighboring notes by admitting bounded gaps or temporally plausible windows. In that sense, they were designed to be musically faithful to tonal closure in polyphonic textures (Sears et al., 2017).

6. Algorithmic procedure, trade-offs, and scope

The reported extraction procedure is straightforward. First, preprocess the symbolic score by full expansion, encode each onset as a VLT kmk_m2, remove duplicates in kmk_m3, allow permutations, and replace onsets with more than three vertical intervals by a maximal subset via contextual back-off. Second, choose kmk_m4 and either a fixed skip bound kmk_m5 or a variable IOI ceiling kmk_m6. Third, for each starting index kmk_m7, search forward for valid kmk_m8 satisfying either kmk_m9 or m=1C(kmn+1)\sum_{m=1}^{C} (k_m - n + 1)0, emit the tuple m=1C(kmn+1)\sum_{m=1}^{C} (k_m - n + 1)1, and increment m=1C(kmn+1)\sum_{m=1}^{C} (k_m - n + 1)2. Fourth, build the frequency distribution and evaluate coverage by cross-validation (Sears et al., 2017).

The method involves explicit trade-offs. Larger m=1C(kmn+1)\sum_{m=1}^{C} (k_m - n + 1)3 or IOI thresholds increase coverage and reduce sparsity, but they also inflate vocabulary size and raise the risk of spurious associations. The study reports that IOI m=1C(kmn+1)\sum_{m=1}^{C} (k_m - n + 1)4–m=1C(kmn+1)\sum_{m=1}^{C} (k_m - n + 1)5 s gave strong coverage gains for 3-grams and 4-grams. It also notes that more skip relations produce more types, so pruning by m=1C(kmn+1)\sum_{m=1}^{C} (k_m - n + 1)6, weighting by temporal proximity, periodicity, or metric strength, and using smoothed probabilities for prediction are natural extensions (Sears et al., 2017).

Computational cost rises quickly with token growth, but bounded settings remained practical in the reported implementation. For m=1C(kmn+1)\sum_{m=1}^{C} (k_m - n + 1)7 chords, all 4-gram tokens were retrieved in less than 100 ms for fixed m=1C(kmn+1)\sum_{m=1}^{C} (k_m - n + 1)8 and less than 3 s for IOI m=1C(kmn+1)\sum_{m=1}^{C} (k_m - n + 1)9 s on commodity hardware. Recommended settings were likewise pragmatic: VLT with full expansion and simple reductions; a focus on 3-grams and 4-grams for harmonic syntax; and skip bounds in fixed σ\sigma0 or IOI windows in σ\sigma1 s to balance coverage and precision (Sears et al., 2017).

The scope of the approach is also clearly delimited. VLT conflates permutations and removes doublings, which may obscure distinctions needed in some analyses. Onsets with more than three intervals are approximated via maximal subsets, which can bias chord identity. The datasets are Western classical repertories with score-aligned performances, so results may differ for other genres or unaligned symbolic corpora. Extremely dense ornamentation can challenge fixed skip bounds, and very high σ\sigma2 or very large skip windows become computationally heavy and noisy. Within those limits, the study’s key takeaway is precise: by incorporating bounded non-contiguity, Hamm-grams recover conventional harmonic patterns obscured by surface embellishments, reduce sparsity, and make higher-order harmonic modeling tractable (Sears et al., 2017).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Hamm-grams.