Chorale Filter

Restrict a search to some of the chorales.

By default a query searches every chorale of the corpus. The optional choraleFilter field narrows that down to the chorales that fit: only the ones that start in a major or minor key, with a word in their title, of a certain length, and so on. It decides which chorales are searched at all and never changes what a pattern finds in them.

{
    "feature": "deg",
    "voices": "soprano",
    "pattern": [{ "deg": "5" }, { "deg": "1" }],
    "choraleFilter": {
        "ids": [1, "chor005-chor100"],
        "excludeIds": "9",
        "title": "Herz",
        "meter": ["4/4", "3/4"],
        "measureCount": { "min": 8, "max": 16 },
        "phraseCount": { "min": 4 },
        "startMode": ["minor", "phrygian"]
    }
}

A chorale is searched only if every field that is set fits it. Fields that take a list are an OR: a single value can be written without the brackets, and the chorale fits when any entry of the list does. A field that is left out restricts nothing. When several queries are combined each one has a chorale filter of its own, so one query can search the minor chorales while another searches the major ones.

FieldTypeFits a chorale that ...
idsnumber/string or arrayis one of these.
excludeIdsnumber/string or arrayis none of these.
titlestring or arrayhas this text in its German or English title.
meterstring or arrayis in this meter at some point, e.g. "4/4".
measureCountnumber or objecthas this many measures.
phraseCountnumber or objecthas this many phrases.
startKeystring or arraystarts in this key, e.g. "G" or "e".
startModestring or arraystarts in this mode, e.g. "minor" or "phrygian".

ids and excludeIds

A chorale is named by the number in its id, so all of these mean chor029:

Written asMeaning
29, "29", "029", "chor029"that one chorale
"5-20", "chor005-chor020"every chorale from number 5 to number 20

The entries of a list can be mixed, [1, "005", "chor010", "20-30"]. A range only has the chorales that exist, and an id that is not in the corpus is no error, it just finds nothing. excludeIds is written the same way and takes chorales out of what ids (or the whole corpus) lets in:

{ "ids": "1-100", "excludeIds": [5, "7-8"] }

The number is the one in the file name. It is not the number of the chorale in the BWV or in any edition.

title

The text a title contains, without regard to upper and lower case. It is looked for in the German and in the English title, and ["Herz", "Seele"] fits a chorale with either word. Spaces are part of the text: "Herz" also finds "Scherz", because it only has to be somewhere in the title, while " Herz" only finds words that begin with it.

{ "title": "wasserflüssen" }

meter

The meters as they are written in the score, "4/4" or "3/4". A chorale fits when it is in one of them at some point, so a chorale that changes from 4/4 to 3/4 fits both.

measureCount and phraseCount

A number is an exact count. An object with min and/or max is a range, and a bound that is left out is open:

{ "measureCount": 12 }
{ "measureCount": { "min": 8, "max": 16 } }
{ "phraseCount": { "min": 6 } }

The measures are counted by their numbers, so a pickup measure is not one. A phrase is closed by a fermata, as for the phrase key; fermatas that sound at the same time close one phrase together.

startKey and startMode

Both are about the key the chorale starts in. A chorale that modulates later still counts as the key it began with: a chorale that begins in G major and moves to E minor is a major chorale here.

startKey is the key as the score writes it. The case of its letter says whether it is major or minor: "G" is G major and "g" is G minor. A flat is written with - and a sharp with #, "B-" and "f#".

startMode is one of major, minor, dorian, phrygian, lydian, mixolydian and locrian. ionian is interpreted as major and aeolian as minor. A key that comes without a label in the score is major or minor by the case of its letter, the church modes need to be labeled in the score (*e:phr).

{ "startMode": ["minor", "dorian"], "meter": "4/4" }