Features

deg

Searching by scale degree.

**deg is Humdrum's deg tool run against each voice: it reduces every note to its scale degree relative to the locally active key, so a search doesn't care about transposition or which exact pitch was sung, only its function in the key.

Token format

Across the corpus, **deg tokens are:

  • a plain digit 1–7 (scale degree, diatonic to the local key), or
  • a digit with one or more trailing + or - characters for a chromatic alteration (e.g. 4+ for a raised 4th, 6- for a lowered 6th; doubled as 4++/7-- for a double alteration), or
  • r for a rest.

Rests produce a real (non-empty) **deg onset, so if you drive a search off deg, a rest counts as one of the onsets your pattern slides across, just like a pitched note does. Exclude rests explicitly with { "!deg": "r" } on a position if you don't want them counted.

Using it in a pattern

{
    "feature": "deg",
    "pattern": [
        { "deg": "3" },
        { "deg": "2", "fermata": false },
        { "deg": ["1", "3"] }
    ]
}

matches a 3 → 2 → 1-or-3 scale-degree run whose middle note carries no fermata: a stepwise descent to (or through) the tonic, in any key, any voice, regardless of the actual pitches involved. See Patterns for OR-lists, wildcards, multi-feature positions, and negation, all of which work the same way for deg as for any other feature.