music21.alpha.analysis.ornamentRecognizer

OrnamentRecognizer

class music21.alpha.analysis.ornamentRecognizer.OrnamentRecognizer

An object to identify if a stream of notes is an expanded ornament. Busy notes refer to the expanded ornament notes. Simple note(s) refer to the base note of ornament which is often shown with the ornament marking on it.

OrnamentRecognizer methods

OrnamentRecognizer.calculateOrnamentNoteQl(busyNotes, simpleNotes=None)

Finds the quarter length value for each ornament note assuming busy notes all are an expanded ornament.

Expanded ornament total duration is time of all busy notes combined or duration of the first note in simpleNotes when provided.

OrnamentRecognizer.calculateOrnamentTotalQl(busyNotes: list[music21.note.GeneralNote], simpleNotes: list[music21.note.GeneralNote] | None = None) float | Fraction

Returns total length of trill assuming busy notes are all an expanded trill. This is either the time of all busy notes combined or duration of the first note in simpleNotes when provided.

TrillRecognizer

class music21.alpha.analysis.ornamentRecognizer.TrillRecognizer(checkNachschlag=False)

An object to identify if a stream of (“busy”) notes is an expanded trill.

By default, does not consider Nachschlag trills, but setting checkNachschlag will consider.

When optional stream of simpleNotes are provided, considers if busyNotes are an expansion of a trill which would be denoted on the first note in simpleNotes.

TrillRecognizer bases

TrillRecognizer methods

TrillRecognizer.recognize(busyNotes, simpleNotes=None) bool | Trill

Tries to identify the busy notes as a trill.

When simple notes is provided, tries to identify busy notes as the trill shortened by simple notes. Currently only supports one simple note in simple notes.

Only when checkNachschlag is true, allows last few notes to break trill rules.

Trill interval size is interval between busy notes.

Returns: False if not possible or the Trill Expression

Methods inherited from OrnamentRecognizer:

TurnRecognizer

class music21.alpha.analysis.ornamentRecognizer.TurnRecognizer

TurnRecognizer bases

TurnRecognizer methods

TurnRecognizer.isAcceptableInterval(intervalToCheck: Interval) bool

Returns whether that interval can occur in a turn

TurnRecognizer.recognize(busyNotes, simpleNotes=None) bool | Turn | InvertedTurn

Tries to identify the busy notes as a turn or inverted turn.

When simple notes is provided, tries to identify busy notes as the turn shortened by simple notes. Currently only supports one simple note in simple notes.

Turns and inverted turns have four notes separated by m2, M2, A2.

Turns: start above base note go down to base note, go down again, and go back up to base note

Inverted Turns: start below base note go up to base note, go up again, and go back down to base note

When going up or down, must go to the adjacent note name, so A goes down to G, G#, G flat, G##, etc

Returns: False if not possible or the Turn/Inverted Turn Expression

Methods inherited from OrnamentRecognizer:

Functions

music21.alpha.analysis.ornamentRecognizer.calculateTrillNoteDuration(numTrillNotes, totalDuration)