Previous topic

music21.trecento.cadencebook

Next topic

music21.trecento.capuaProbabilities

Table Of Contents

Table Of Contents

This Page

music21.trecento.capua

The regola of Nicolaus de Capua are four rules for determining proper musica ficta, that is unnotated accidentals. These rules look only at a single melodic voice (which is corresponds to how fourteenth-century music was notated, as successive voices) even though they affect the harmony of the period.

The module contains methods for automatically applying the rules of Nicolaus de Capua, for putting these accidentals into the Stream, and, by running the attachIntervalsBetweenStreams() method of Stream objects, seeing how well these rules correct certain harmonic problems in the music.

Functions

music21.trecento.capua.applyCapuaToCadencebookWork(thisWork)

runs Nicolaus de Capua’s rules on a set of incipits and cadences as PolyphonicSnippet objects (a Score subclass)

>>> import copy
>>> b = trecento.cadencebook.BallataSheet().makeWork(331) # Francesco, Non Creder Donna
>>> bOrig = copy.deepcopy(b)
>>> trecento.capua.applyCapuaToCadencebookWork(b)
>>> bFN = b.asScore().flat.notes
>>> for n in bFN:
...    trecento.capua.capuaFictaToAccidental(n)
>>> bOrigFN = bOrig.asScore().flat.notes
>>> for i in range(len(bFN)):
...    if bFN[i].pitch != bOrigFN[i].pitch: 
...        print("%s %s" % (str(bFN[i].pitch), str(bOrigFN[i].pitch)))
F#3 F3
C#3 C3
C#3 C3
F#3 F3
music21.trecento.capua.applyCapuaToScore(thisWork)

runs Nicolaus de Capua’s rules on a Score object,

calls applyCapuaToStream to each part.flat in parts.

music21.trecento.capua.applyCapuaToStream(thisStream)

Apply all the Capua rules to a Stream. Runs clearFicta, capuaRuleOne, capuaRuleTwo, capuaRuleThree and capuaRuleFourB.

Runs in place.

music21.trecento.capua.capuaFictaToAccidental(note1)

Moves Capua’s ficta from Note.editorial.misc[‘capua-ficta’] to the Note.pitch.accidental object. Saves the previous accidental by calling clearAccidental first.

music21.trecento.capua.capuaRuleFourA(srcStream)

See capuaRuleOne for precise instructions.

Applies one interpretation of Capua’s fourth rule to the given srcStream, i.e. if a descending minor third is followed by a descending major second, the intervals will be changed to a major third followed by a minor second. Also changes note.editorial.color for rule 4 (orange green orange).

returns the number of notes that were changed

This rule is a less likely interpretation of the ambiguous rule 4, thus applyCapuaToStream uses capuaRuleFourB instead.

music21.trecento.capua.capuaRuleFourB(srcStream)

See capuaRuleOne for precise instructions.

Applies more probable interpretation of Capua’s fourth rule to the given srcStream, i.e. if a descending minor third is followed by a descending major second, the intervals will be changed to a major third followed by a minor second. Also copies any relevant accidental to note.editorial.misc under “saved-accidental” and changes note.editorial.color for rule 4 (orange green orange).

returns the number of times a note was changed.

music21.trecento.capua.capuaRuleOne(srcStream)

Applies Nicolaus de Capua’s first rule to the given srcStream, i.e. if a line descends a major second then ascends back to the original note, the major second is made into a minor second. Also copies the relevant accidentals into Note.editorial.misc[“saved-accidental”] and changes Note.editorial.color for rule 1 (blue green blue).

The relevant Rule number is also stored in Note.editorial.misc[‘capua_rule_number’] which can be got out by OR-ing this.

Returns the number of notes that were changed (not counting notes whose colors were changed).

music21.trecento.capua.capuaRuleThree(srcStream)

See capuaRuleOne for precise instructions.

Applies Capua’s third rule to the given srcStream, i.e. if there is a descending major third followed by an ascending major second, the second note will be made a half-step higher so that there is a descending minor third followed by an ascending minor second. Also changes note.editorial.color for rule 3 (pink green pink).

returns the number of times a note was changed

music21.trecento.capua.capuaRuleTwo(srcStream)

See capuaRuleOne for precise instructions.

Applies Capua’s second rule to the given srcStream, i.e. if four notes are ascending with the pattern M2 m2 M2, the intervals shall be made M2 M2 m2. Also changes note.editorial.color for rule 2 (purple purple green purple).

returns the number of times any note was changed

music21.trecento.capua.clearAccidental(note1)

moves the accidental to Note.editorial.misc[‘saved-accidental’] and clears Note.pitch.accidental

music21.trecento.capua.clearFicta(srcStream1)

In the given srcStream, moves anything under note.editorial.ficta into note.editorial.misc under “saved-ficta”.

music21.trecento.capua.colorCapuaFicta(srcStream1, srcStream2, oneOrBoth='both')

Given two srcStreams, applies the capua rules and colors each note (in note.editorial.misc under “ficta-color”) as compared to the srcStreams with no ficta, using betterColor, worseColor, and neutralColor.

music21.trecento.capua.colorNote(note1, oneOrBoth='both')

Applies all rules to a note according to what harmonies are better/worse/neutral.

music21.trecento.capua.compareNoteCapuaToEditor(note1)

Takes in a single note and returns a dictionary showing how many notes are there totalNotes, how many the editors of PMFC altered, how many the Capua program altered, how many PMFC but not Capua altered and how many both altered.

To be added up by compareSrcStreamCapuaToEditor. To be run after applyCapua.

music21.trecento.capua.compareOnesrcStream(srcStream1, srcStream2, fictaType='editor')

Helper function for evaluating Harmony that for each note in srcStream1 determines that notes starting interval in relation to srcStream2, and assigns identifiers to the fictaHarmony and fictaInterval in note.editorial if there is ficta, or to the noFictaHarmony if there is no ficta for that note. Returns a list of the number of perfect consonances, imperfect consonances, and other (dissonances) for srcStream1. For the fictaType variable, write “editor” or “capua”, “capua1srcStream” or “capua2srcStream”.

music21.trecento.capua.compareSrcStreamCapuaToEditor(srcStream1)

takes a Stream (can be flat.notesAndRests or not) and returns a dictionary showing how many notes are there totalNotes, how many the editors of PMFC altered, how many the Capua program altered, how many PMFC but not Capua altered and how many both altered.

music21.trecento.capua.compareThreeFictas(srcStream1, srcStream2)

compares the output of noFicta, pmfcFicta, and capuaFicta and attaches each interval to a note.editorial.misc tag.

srcStream1 and srcStream2 should be .flat.notesAndRests

>>> b = trecento.cadencebook.BallataSheet().makeWork(331).asScore()
>>> b.show()
>>> trecento.capua.applyCapuaToStream(b.parts[0].flat.notesAndRests)
>>> trecento.capua.compareThreeFictas(b.parts[0].flat.notesAndRests, b.parts[1].flat.notesAndRests)
>>> for n in b.parts[0].flat.notesAndRests:
...    pass #print n.pitch, n.editorial.misc['normal-harmonicInterval'], n.editorial.misc['pmfc-harmonicInterval'], n.editorial.misc['capua-harmonicInterval']
music21.trecento.capua.evaluateCapuaOnesrcStream(srcStream1, srcStream2)

Runs Capua rules on one srcStream only and evaluates the harmonies; stores harmonies under “capua1FictaHarmony” in note.editorial.misc; returns a list of the number of [perfect cons, imperfect cons, dissonances].

music21.trecento.capua.evaluateCapuaTwoStreams(srcStream1, srcStream2)

Runs Capua rules on both srcStreams and evaluates the harmonies; stores harmonies under “capua2FictaHarmony” in note.editorial.misc; returns a dictionary that contains the number of [perfect cons, imperfect cons, dissonances] for each srcStream, which can be obtained with keys “srcStream1Count” and “srcStream2Count”.

music21.trecento.capua.evaluateEditorsFicta(srcStream1, srcStream2)

Runs pmfcFictaToAccidental, then runs the evaluation method on the two srcStreams. Returns editorProfile, a list of lists with the number of perfect cons, imperfect cons, and dissonances for each srcStream.

music21.trecento.capua.evaluateRules(srcStream1, srcStream2)

Runs evaluation method for capua on one srcStream only, and evaluating harmonies, for each srcStream; then runs method for applying capua rules to both and evaluating the resulting harmonies.

music21.trecento.capua.evaluateWithoutFicta(srcStream1, srcStream2)

Clears all ficta, then evaluates the harmonies of the two srcStreams. Returns a list of lists of the interval counts for each.

music21.trecento.capua.fictaToAccidental(note1)

Moves the ficta (if any) in Note.editorial.ficta to the accidental

music21.trecento.capua.findCorrections(correctionType='Maj3', startPiece=2, endPiece=459)
Find all cases where a Major 3rd moves inward to unison (within the next two or three notes, excluding rests)

and see how often the PMFC editors correct it to minor 3rd and how often Capua gets it.

or if correctionType == “min6” find all instances of a minor 6th moving outward to octave and see how often the PMFC editors correct it to a Major 6th and how often Capua gets it.

# # >>> (totalDict, foundPieceOpus) = findCorrections(correctionType=”Maj3”, 2, 50) # >>> print(totalDict) # {‘potentialChange’: 82, ‘capuaAlt’: 30, ‘pmfcAndCapua’: 3, ‘capuaNotPmfc’: 27, ‘pmfcAlt’: 4, ‘pmfcNotCapua’: 1, ‘totalNotes’: 82} # >>> foundPieceOpus.show(‘lily.pdf’)

# >>> (totalDict, foundPieceOpus) = findCorrections(correctionType=”min6”) # >>> print(totalDict) # {‘potentialChange’: 82, ‘capuaAlt’: 30, ‘pmfcAndCapua’: 3, ‘capuaNotPmfc’: 27, ‘pmfcAlt’: 4, ‘pmfcNotCapua’: 1, ‘totalNotes’: 82} # >>> foundPieceOpus.show(‘lily.pdf’)

# >>> (totalDict, foundPieceOpus) = trecento.capua.correctedMin6() # >>> print(totalDict) # {‘alterAll’: 82, ‘capuaAlt’: 30, ‘pmfcAndCapua’: 3, ‘capuaNotPmfc’: 27, ‘pmfcAlt’: 4, ‘pmfcNotCapua’: 1, ‘totalNotes’: 82} # >>> foundPieceOpus.show(‘lily.pdf’)

music21.trecento.capua.getIntervalType(interval1)

returns either None (if interval is undef), “perfect cons”, “imperfect cons”, “dissonance” or an error depending on how the interval fits into 14th century harmonic principles

music21.trecento.capua.improvedHarmony(startPiece=2, endPiece=459)

Find how often an augmented or diminished interval was corrected to a perfect interval and vice-versa by capua.

Returns a dict showing the results

>>> trecento.capua.improvedHarmony()
{'imperfCapua': 22, 'imperfIgnored': 155, 'perfCapua': 194, 'perfIgnored': 4057}
music21.trecento.capua.pmfcFictaToAccidental(note1)

Moves any ficta in Note.editorial.misc[‘pmfc-ficta’] to the Note.pitch.accidental object and saves the previous accidental by calling clearAccidental() first.

music21.trecento.capua.restoreAccidental(note1)

takes Note.editorial.music[‘saved-accidental’] and moves it back to the Note.pitch.accidental

music21.trecento.capua.restoreFicta(srcStream1)

In the given srcStream, moves anything under note.editorial.misc[“saved-ficta”] back to note.editorial.ficta.

music21.trecento.capua.ruleFrequency(startNumber=2, endNumber=459)
music21.trecento.capua.ruleOne(nonCapuaHarmony, capuaHarmony)

Colors a note based on the rule dissonance -> perfect cons is better, perfect cons -> dissonance is worse.

music21.trecento.capua.runPiece(pieceNum=331, snipNum=0)