Skip to main content

Module analysis

Module analysis 

Source
Expand description

Key-finding and compact analysis helpers.

Modules§

correlate
How what a stream’s notes sound goes with the dynamics they sound under: music21’s analysis.correlate.
elements
Counting what a stream’s elements say: music21’s analysis.elements.
enharmonics
The best spelling of a run of pitches: music21’s analysis.enharmonics.
floating_key
A key for every measure, each measure’s own reading smoothed by its neighbours’: music21’s analysis.floatingKey.
harmonic_function
Harmonic function labels and the Roman numerals they stand for: music21’s analysis.harmonicFunction.
metrical
Metrical and melodic accent: music21’s analysis.metrical.
neoriemannian
Neo-Riemannian transformations of triads: music21’s analysis.neoRiemannian.
patel
Aniruddh D. Patel’s measures of rhythm and melody: music21’s analysis.patel.
pitch_analysis
Counting a stream’s pitches: music21’s analysis.pitchAnalysis.
reduce_chords
A score reduced to the chords it is made of: music21’s analysis.reduceChords.
reduction
Reductions written into a score by its lyrics: music21’s analysis.reduction.
segment_by_rests
A part cut into the runs of notes between its rests: music21’s analysis.segmentByRests.
transposition
How many distinct transpositions a set of pitches has: music21’s analysis.transposition.
windowed
An analysis run over windows of a stream, from a quarter note long to the whole of it: music21’s analysis.windowed.

Structs§

KeyEstimate
A ranked key estimate.

Enums§

KeyProfile
A set of key-finding weights for the Krumhansl-Schmuckler algorithm.

Functions§

estimate_key_from_chords
Estimates likely keys from chords using the Krumhansl-Schmuckler weights.
estimate_key_from_chords_with
Estimates likely keys from chords using the given weights.
estimate_key_from_distribution
Every key ranked by how well profile fits distribution, best first: music21’s key-weight analysis.
estimate_key_from_pitches
Estimates likely keys from pitches using the Krumhansl-Schmuckler weights.
estimate_key_from_pitches_with
Estimates likely keys from pitches using the given weights, each pitch counting once.
estimate_key_of_stream
The keys a stream is likely in, best first, by profile’s weights over its duration-weighted pitch classes: music21’s KeyWeightKeyAnalysis run on a stream. Nothing for a stream with no notes.
melodic_interval_counts
Every melodic interval between neighbouring notes of each line, with how often it comes, in the order each is first met: music21’s MelodicIntervalDiversity.countMelodicIntervals. With ignore_direction a falling interval counts as the rising one, and with ignore_unison a repeated note does not count. Intervals are told apart by their directed name, and the first of each is the one kept.
melodic_line_positions
The same lines as positions in Stream::leaves, which is the by-position twin melodic_lines reads its own answer off: the note a count was taken from is the note the stream holds, so a caller handing back objects can hand back its own.
melodic_lines
The melodic lines of a stream, as music21’s MelodicIntervalDiversity reads them: each part-like stream it holds on its own, or the stream as one line where it holds none; the notes of each in order, chords and rests left out, and a note continuing a tie heard once.
pitch_class_distribution
How long each pitch class sounds: for each note, its pitches and its length in quarter notes, every pitch counting for the whole length. Nothing when there are no notes. music21’s _getPitchClassDistribution, a quarter tone rounding to the even class as music21’s pitchClass does.
pitch_span
The lowest and the highest pitch among pitches, the first of each where several share a place: music21’s Ambitus.getPitchSpan. Nothing for no pitches.
stream_distribution
How long each pitch class sounds in a stream, nested streams included: music21’s _getPitchClassDistribution over the stream’s notes, each pitch counting for its note’s whole length. A note is music21’s: a note, a chord, a chord symbol or the pitched members of a percussion chord, so a stream of chord symbols lasting nothing has a distribution of nothing but noughts. Nothing for a stream with no notes at all.
stream_pitch_span
The lowest and highest pitch sounding anywhere in a stream: music21’s Ambitus.getPitchSpan, which leaves chord symbols out.
tonal_certainty
How decisively the first of a ranked list of key estimates wins: music21’s Key.tonalCertainty for a key that came out of analysis. It is the leader’s score plus twice its lead over the next positive score; with no positive runner-up it is the leader’s score, floored at zero.
tonal_certainty_from_scores
The same measure over the scores alone, for a ranking that came from somewhere else — music21 hands its own analysis results around as keys carrying a correlationCoefficient rather than as estimates.