Feature definition¶
The following table presents the definition of all the stock features provided with musif.
The first column are Python Regular Expressions that match the relevant columns of the final DataFrame.
The .+ at the beginning of a pattern stands for the scope prefix of the column:
Part<Abbreviation>_ (one part), Sound<Abbreviation>_ (all parts of one instrument),
Family<Abbreviation>_ (all parts of one family), or Score_ (all parts). Each row
states the scopes at which the feature is actually produced. Staves that resolve to the
same part abbreviation are treated as one logical part (counts summed, extremes merged).
For a sound performed by exactly one part, every Sound<X>_ column equals the
corresponding Part<X>_ column by construction (the sound scope aggregates over that
one part); the DataProcessor option delete_duplicated_sound_columns drops these
duplicates, keeping the per-part means and part counts.
Conventions used throughout:
every
_Percolumn is a proportion between 0 and 1, not a percentage;a value that cannot be computed is NaN, never 0: a ratio whose denominator is zero, a statistic of nothing, any feature of a part that is not in the score. A 0 is always a measured value. The
replace_nansoption of theDataProcessorkeeps to this: it turns an empty cell into 0 only in the columns that count events or give their proportion, and only for the scores in which the part has notes (and, for the columns that depend on the harmonic analysis, in which the analysis is available);pitches are analysed as they sound: the part of a transposing instrument (horn, trumpet, clarinet…) is transposed by the interval stated in its file before any feature is computed, so its scale degrees and ambitus, and the aggregates that include it, describe the notes that are heard. A part whose file states no transposition is taken as written;
intervals and melodic motion follow melodic lines. In each part, the measures written in one voice and the first voice of the measures written in several voices form the main line. Every other voice is a line of its own, and it starts anew at each passage (a run of consecutive measures in which that voice is written): nothing is measured from one passage to the next. A measure in which nothing at all is written for the part (the second part of a split staff, while the staff shows a single line) ends the main line in the same way;
chords (double stops, keyboard chords) are excluded from note-based features, although a measure containing only chords still counts as sounding;
scale degrees in minor keys are measured against the natural minor scale (the signature that the key has by modern convention, which is not always the one notated), so a raised leading tone is
Degree#7. A degree column therefore does not mean the same in the two modes:Degree7is the leading tone of a major key and the subtonic of a minor one. The same holds, passage by passage, for the degrees relative to the local key. Compare arias across modes withModeat hand;rates are given in two units of time. The beat is the one of each time signature (
NumberOfBeats: four in 4/4, two in 2/2 and 6/8, one in 3/8), and a rate per beat (Density,RhythmInt,DottedRhythm,DynGrad,DynAbruptness,HarmonicRhythmBeats) changes with the metre a piece is notated in: the same notes written in 2/2 give twice the density per beat they give in 4/4. The columns ending inQuartersgive the same rates per quarter note, which is the same length in every metre; use them to compare arias in different metres. Neither unit knows the tempo;by default every feature describes the notated score, read once through: repeats, da capo and dal segno instructions are not followed. In an aria whose reprise is not written out, the opening section is on the page once although it is performed twice, so proportions and means weigh it less than a score with a written-out reprise does.
RepriseInstructiontells the two kinds of score apart. Withexpand_repeats, every feature describes instead the score as it is played: its measures are unfolded in the order that ms3 gives its MuseScore file (repeat signs, voltas, da capo and dal segno to Fine or Coda), and the harmonic annotations follow the same order. This needs the MuseScore file, and it is applied only where that file is the MusicXML file annotated, bar for bar (as many measures, each as long); a score that cannot be unfolded is analysed as written, andRepeatsUnfoldedsays which is which. Where the order jumps, the measure jumped to keeps the time signature, key signature and clef in force at its place;the
Score_value of a feature covers every part of the score, and depends on which parts those are. Where it pools the notes of all parts (intervals, scale degrees, ambitus), it is dominated by the parts with most notes, usually the strings. Where it is a mean over parts (Density,RhythmInt,DottedRhythm, the dynamics), a pair of horns that plays twenty notes weighs as much as the first violins, and an aria with winds comes out less dense than the same music without them. To compare arias of different scoring, use the columns of the parts they share (PartVnI_,PartBs_,FamilyStr_…) rather thanScore_;in windowed extraction only complete windows are analyzed (a tail shorter than one window is skipped) and per-window rows have
Measuresequal to the window size.
Finally, the Stock module column lists the module distributed in musif that
generates each feature. The stock feature modules are: core, ambitus, melody,
tempo, density, texture, harmony, lyrics, scale, scale_relative, key,
dynamics, rhythm and music21, plus the basic modules scoring and
file_name_generic.
Note that none of these features works on percussion instruments.
In addition to the features in the present page, the features in the 'music21' stock
module (first row of the below table) provide all the features from music21.features.native.
Column RegEx |
Explanation |
Stock module |
|---|---|---|
|
Music21 features from |
|
|
Numeric identifier of the file within the extraction |
added by the extractor |
|
Index of the window within its score (0 when no windowing is used) |
added by the extractor |
|
Half-open range of 0-based measure indices covered by the window, e.g. |
added by the extractor |
|
File name of the original score |
|
|
Text before the first underscore of the file name (empty when there is none) |
|
|
Text after the first underscore of the file name (the whole stem when there is none) |
|
|
No. of measures of the piece (of the window, in windowed extraction) |
|
|
No. of measures that have at least one note (not all silence). Part scope counts the part’s own measures; sound/family/score scopes are sums over their parts |
|
|
Sounding measures per part, i.e. the summed sounding measures / no. of parts, at sound/family/score scope |
|
|
No. of notes. Part scope counts the part; sound/family/score scopes are sums over their parts |
|
|
Notes per part, i.e. the summed notes / no. of parts, at sound/family/score scope |
|
|
Initial time signature of the piece (later changes are not reported here) |
|
|
Type of meter of the initial time signature: simple duple (1/X, 2/X, 4/X, 8/X), simple triple (3/2, 3/4, 3/8, 3/16), compound duple (6/X), compound triple (9/X), compound quadruple (12/X), or other. 3/8 is simple triple, although |
|
|
No. of beats per measure implied by the initial time signature |
|
|
Key in which the piece is written. The relation to annotated key signature may not be straightforward |
|
|
Key signature of the piece according to modern convention; might not correspond to the one annotated on the score |
|
|
Comma-separated abbreviations of the instrumental (non-voice) families present on the score |
|
|
Comma-separated abbreviations of all families present on the score, voices included |
|
|
Comma-separated sound abbreviations of everything present on the score, voices included |
|
|
Instruments on the score, using Italian abbreviation; 2 parts of the same instrument are simplified as 1 such instrument |
|
|
List of parts on the score, including voices, using Italian abbreviation; 2 parts of the same instrument are not simplified. A part carries a Roman numeral when its own name does ( |
|
|
Number of parts found on the score, for each sound and family and for the whole score. Staves are counted: a staff split into two players counts two, and two staves with the same abbreviation (the two sopranos of a duet) count two, although they are one logical part |
|
|
Number of parts kept by |
|
|
Voice parts included on the score, ordered from high to low when the voice type is known. Voices of the same type are not numbered: they are one logical part |
|
|
Type of |
|
|
Mode of the |
|
|
Numeric tempo of the piece, as stated by the engravers and correctors in the MusicXML file: the first |
|
|
Verbal annotation for the tempo, as defined by the composer: the first tempo word of the first measure (of the first full measure, when the score opens with a pickup that carries none). Later changes of tempo are not reported |
|
|
1 when the score carries a da capo or dal segno instruction, 0 when it does not. With such an instruction the reprise is performed but not written out, so every proportion and mean describes the notated page, on which the opening section appears once; without it, a reprise that exists is on the page twice. Compare arias across this column with care |
|
|
1 when the measures of the score were unfolded in the order in which they are played ( |
|
|
Classification of |
|
|
Classification of |
|
|
Notes per beat: summed notes of the scope’s parts / summed per-measure beats of those parts (metre changes are respected at every scope, and a single-part sound equals its part). The beat is the one of each time signature (see |
|
|
Notes per quarter note. The same per quarter note instead of per beat: the quarter note is the same in every metre, so this version is comparable between arias in 4/4, 2/2, 3/8… |
|
|
Notes per sounding beat: summed notes / summed per-measure beats of the sounding measures, a ratio of sums over the scope’s parts. NaN for a scope that never sounds. Produced at part/sound/family/score scope |
|
|
Notes per quarter note of the sounding measures. The same per quarter note instead of per beat: the quarter note is the same in every metre, so this version is comparable between arias in 4/4, 2/2, 3/8… |
|
|
1 when the harmonic features were successfully extracted from the MuseScore analysis file, 0 otherwise (no analysis file, or the extraction failed) |
|
|
No. / proportion of annotations / proportion of annotated time of each chord on a degree of the key in force, labelled by its numeral plus its chord type ( |
|
|
The same for the chords applied to a degree other than the tonic of the key in force ( |
|
|
Proportion of harmonic annotations of each chord type: major triad, minor triad, 7th, dim, aug, aug6, other. With the suffix |
|
|
No. / proportion of annotations / proportion of annotated time of the chords of each harmonic function in the key in force: T, SD, D, MED, NAP, ST, LN… Upper and lower case follow the quality of the chord ( |
|
|
The same without the distinction of chord quality: |
|
|
Harmonic rhythm of the piece, calculated as no. of harmonic annotations / |
|
|
Harmonic rhythm of the piece by beats, calculated as no. of harmonic annotations / total no. of beats (beats are summed over the measures of the score, each after the time signature in force in it, whether or not it carries a label). It follows the metre: an aria in 3/8 has one beat per measure, one in 4/4 four |
|
|
Harmonic annotations per quarter note. The same per quarter note instead of per beat: the quarter note is the same in every metre, so this version is comparable between arias in 4/4, 2/2, 3/8… |
|
|
Proportion of measures that are in a given local key, extracted from the LocalKey column of the harmonic analysis. Measures are counted by their position in the file (a second ending and a bar excluded from the numbering count as measures), each key lasts from its first label to the label of the next key, and the last key lasts to the end of the piece |
|
|
Proportion of key areas (sections) spent in a given local key, extracted from the LocalKey column of the harmonic analysis |
|
|
Riemannian groupings of the two rows above (D=V, d=v, Dom=D+d, SD=IV/II/VI, sd=iv/ii, SubD=SD+sd, T=I/i, rel=III/vi), added by the |
postprocessing |
|
No. / proportion of annotations / proportion of annotated time of each numeral of the key in force, as included in the “Numeral” column of the harmonic analysis. Applied chords are counted together under |
|
|
Proportion of annotations whose “changes” field falls in each bucket: |
|
|
Melodic speed, in semitones per quarter note. 1. split the part into melodic segments (a new segment starts after every rest and at every chord, which is not part of a melodic line, and each melodic line, as defined in the conventions above, is its own sequence of segments); 2. resample each segment on a regular grid of S quarter notes (each note covers its span of grid points); 3. take the differences between consecutive samples inside each segment — never across a rest — and divide by S; 4. this feature is the mean of the absolute differences pooled over all segments. Steps S: 0.25, 1 and 2 ( |
|
|
1. smooth each resampled segment with a centered rolling mean of 2·W+1 samples; 2. a “chunk” is a maximal run of strictly rising smoothed samples within one segment; this feature is the average length of the rising chunks, in quarter notes, pooling the chunks of all segments. Steps S: 0.25, 0.5 and 1; windows W: 2 and 4 ( |
|
|
Like |
|
|
Proportion of rising steps over all smoothed steps of the measured segments (see |
|
|
Proportion of falling steps over all smoothed steps of the measured segments. NaN when no segment holds a full window. Part scope only |
|
|
Average duration of the note values (quarter note = 1, eighth note = 0.5, etc.), excluding zero-duration grace notes. Produced at part/score scope |
|
|
No. of single-dotted figures (a dotted note shorter than one beat followed, on the same beat of the same measure, by a shorter note) / the beats of the sounding measures, summed measure by measure after the time signature in force. Both the beat that a figure must fit in and the denominator depend on the metre. Produced at part/score scope (score = mean over parts with sounding measures) |
|
|
The same figures per quarter note of the sounding measures |
|
|
No. of doubly dotted figures (same rule, two dots) / the beats of the sounding measures, summed measure by measure after the time signature in force. Produced at part/score scope |
|
|
The same figures per quarter note of the sounding measures |
|
|
Sum of the duration of the notes (in quarter notes) / the beats of the sounding measures, summed measure by measure after the time signature in force. It is the length of the beat times the share of the time that is filled with notes, so it mostly tells the metre. Produced at part/score scope (score = mean over parts) |
|
|
Sum of the duration of the notes / quarter notes of the sounding measures: the share of the sounding time that is filled with notes (above 1 where two lines of a part sound together). Comparable between metres |
|
|
No. of notes corresponding to the given scale degree in relation to the main key of the piece (natural minor reference in minor keys). Produced at part/score scope; the score is the sum over all parts |
|
|
Proportion of the row above over the notes counted for the scope (NaN when the scope has no notes) |
|
|
No. of notes corresponding to the given scale degree in relation to the local key of the passage the note is in (requires MuseScore harmonic analysis). A note takes the key of the last label at or before it, found by the position of its measure in the file and its onset in the measure (printed bar numbers differ between the MusicXML and the MuseScore file at Finale’s X bars and in voltas); before the first label it takes the first key, after the last the last. Produced at part/score scope; the score is the sum over all parts |
|
|
Proportion of the row above over the notes counted for the scope |
|
|
Grouped degrees relative to the main key: raised ( |
postprocessing |
|
Same grouping for the local-key degrees |
postprocessing |
|
Sum of absolute values of ((dynamic marking 2 − dynamic marking 1) / no. of beats from marking 1 to marking 2), divided by the total no. of beats. Produced at part/score scope |
|
|
The same with both times in quarter notes instead of beats, comparable between metres |
|
|
Mean rate of change between successive markings: sum of absolute values of ((dynamic marking 2 − dynamic marking 1) / no. of beats from marking 1 to marking 2, rests included), divided by the no. of such changes. NaN with fewer than two levels. Produced at part/score scope |
|
|
The same per quarter note instead of per beat, comparable between metres |
|
|
Mean of the dynamic values of the part’s markings, each level counted once however long it lasts. A repeated identical marking counts once, and |
|
|
Mean dynamic value over the sounding beats: sum of (dynamic value × no. of sounding beats in which it is in force) / no. of sounding beats that have a marking in force. What sounds before the first marking has no stated level and is left out. Produced at part/score scope (score = mean over the parts that carry markings) |
|
|
Ambitus (highest minus lowest MIDI pitch), in number of semitones. Produced at part/sound/family/score scope |
|
|
MIDI pitch of the highest note. Produced at part/sound/family/score scope |
|
|
MIDI pitch of the lowest note. Produced at part/sound/family/score scope |
|
|
Highest note, as note name with octave. Produced at part/sound/family/score scope |
|
|
Lowest note, as note name with octave. Produced at part/sound/family/score scope |
|
|
Kurtosis of the interval sizes (difference between the MIDI pitch of two notes). Melody features are produced at part/sound/score scope (no family) |
|
|
Sample std of the interval sizes (difference between the MIDI pitch of two notes) |
|
|
Mean of the signed interval sizes (difference between the MIDI pitch of two notes). The signed intervals of a melodic line cancel out: their sum is the last pitch minus the first. This is therefore the net displacement of the lines divided by the number of intervals, close to 0 in any part, and it says little about the shape of the melody; see |
|
|
Skewness of the interval sizes (difference between the MIDI pitch of two notes) |
|
|
Kurtosis of the absolute interval sizes (in no. of semitones) |
|
|
Mean of the absolute interval sizes (in no. of semitones) |
|
|
Skewness of the absolute interval sizes (in no. of semitones) |
|
|
Sample std of the absolute interval sizes (in no. of semitones) |
|
|
|
|
|
( |
|
|
Mean of the absolute interval sizes (in no. of semitones), trimming the most extreme 10% at each tail |
|
|
Sample std of the absolute interval sizes (in no. of semitones), trimming the most extreme 10% at each tail |
|
|
Mean of the interval sizes (in no. of semitones, positive and negative), trimming the most extreme 10% at each tail |
|
|
Sample std of the interval sizes (in no. of semitones, positive and negative), trimming the most extreme 10% at each tail |
|
|
Mean of the sizes of the ascending intervals (in no. of semitones); NaN when there are none |
|
|
Sample std of the sizes of the ascending intervals (in no. of semitones) |
|
|
Mean of the sizes of the descending intervals (negative, in no. of semitones) |
|
|
Sample std of the sizes of the descending intervals (in no. of semitones) |
|
|
No. of ascending intervals |
|
|
Proportion of |
|
|
No. of descending intervals |
|
|
Proportion of |
|
|
No. / proportion of each specific interval, named by |
|
|
No. / proportion of ascending intervals of a given type (Perfect, Major, Minor, Augmented, Diminished, double variants, WithinOctave, BeyondOctave) |
|
|
No. / proportion of descending intervals of a given type |
|
|
No. / proportion of intervals of a given type in either direction (unisons included). Note: |
|
|
No. / proportion of [Asc, Desc, All] stepwise intervals (seconds, and chromatic unisons such as A1/d1) |
|
|
No. / proportion of [Asc, Desc, All] leaps (interval of a 3rd or larger) |
|
|
No. of consecutively repeated notes (the pitch does not change: 0 semitones). Equals |
|
|
Proportion of |
|
|
Sum of all the ascending intervals, counted as semitones |
|
|
Sum of all the descending intervals, counted as semitones (negative) |
|
|
Largest interval in number of semitones, disregarding the direction (the interval of largest magnitude in either direction). The |
|
|
Largest [asc, desc, all] interval in number of semitones, keeping the sign. When the largest rising and falling intervals are equal (a +12 and a −12), |
|
|
Largest [asc, desc, all] interval, as the notated |
|
|
Smallest [asc, desc] interval in number of semitones, keeping the sign. The |
|
|
Smallest [asc, desc] interval, as the notated |
|
|
Interval name of the rounded mean absolute interval (it disregards direction, so it is never a descending interval) |
|
|
Where the centre of the vocal part lies in relation to the tonic: the distance in semitones from the mean MIDI pitch of the part to the nearest tonic of the key of the piece (between −6 and 6, positive when the centre lies above that tonic), averaged over the vocal staves (two staves of the same voice type count twice) |
|
|
No. of syllables in a given vocal part, as introduced by the music engraver: the lyrics that carry text (a note carrying several verses contributes one syllable per verse; the text-less marker that closes a melisma line is not a syllable). Produced at part/score scope |
|
|
No. of notes / no. of syllables. The score scope is the ratio of the summed notes and syllables of all vocal parts (a note-weighted aggregate). NaN without lyrics |
|
|
|
|
|
Inclusion (1/0) of a given part on the score; empty for a score that failed to extract |
added if |
|
No. of notes of Part[1] / no. of notes of Part[2], using each part’s actual note count. NaN when Part[2] has no notes. Pairs follow the configured scoring order, so a pair always yields the same column across a corpus |
|
Notes for typical notated corpora¶
On the opera-seria corpus used to validate these features (and most notated corpora of the period), several column families are structurally degenerate; they are kept for generality but carry no information there:
DoubleAugmented/DoubleDiminishedinterval columns are all zero.DoubleDottedRhythmis not: the corpus has 411 doubly dotted notes in 70 scores, but it is zero in most arias.m21_ChordBassMotionFeature_0is the constant1.0sentinel thatmusic21emits when a score contains no chord-symbol objects (notated scores never do); features_1through_11are zero.the processed
Degree_.+_Dasc/_Ddesccolumns are zero, soNonat = Asc + Descthere.rare chromatic degrees and interval qualities are all-zero on most corpora; wherever a directional count is all-zero, its
Alltwin equals the other direction.Presence_of_Xis constant 1 for instruments present corpus-wide (voices are excluded fromInstrumentationby design), and equals “Sound<X>_NumberOfPartsis not NaN” row by row.