# 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. Finally, the _Stock module_ column lists the module distributed in `musif` and that generates each feature. 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`](http://web.mit.edu/music21/doc/moduleReference/moduleFeaturesNative.html). | **Column RegEx** | **Explanation** | Stock module | |------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------| | `m21_.*` | Music21 features | `music21` | | `FileName` | File name of the original score | `core` | | `Measures` | No. of measures of the piece | `core` | | `.+_SoundingMeasures` | No. of measures that have at least one note (not all silence) for a given part | `core` | | `.+_SoundingMeasuresMean` | Mean of no. of sounding measures for all parts in a sound/family | `core` | | `.+_no.es` | No. of notes for a given part | `core` | | `.+no.esMean` | Mean of no. of notes for all parts in a sound/family | `core` | | `TimeSignature` | Time signature(s) of the piece | `core` | | `TimeSignatureGrouped` | Type of meter of the piece, classified in Simple duple, Simple triple, Compound duple, or Compound triple | `core` | | `NumberOfBeats` | Total no. of beats in the score or window | `core` | | `Key` | Key in which the piece is written. The relation to annotated key signature may not be straightforward | `core` | | `KeySignature` | Key signature of the piece according to modern convention; might not correspond to the one annotated on the score | `core` | | `FamilyInstrumentation` | Intruments present in a given family (e.g., strings, woodwinds, etc.) | `scoring` | | `SoundScoring` | Instruments present in a given sound (e.g., violin, flute, etc.) | `scoring` | | `Instrumentation` | Instruments on the score, using Italian abbreviation; 2 parts of the same instrument are simplified as 1 such instrument | `scoring` | | `Scoring` | List of parts on the score, including voices, using Italian abbreviation; 2 parts of the same instrument are not simplified; various parts of the same instrument/voice are indicated by Roman numerals attached ot the part abbreviation | `scoring` | | `.+_NumberOfParts` | Number of parts found on the score for each sound or family | `scoring` | | `.+_NumberOfFilteredParts` | Number of parts that have been filtered out of each sound or family | `scoring` | | `Voices` | Type(s) of voice included on the score, ordered from high to low (when relevant) | `scoring` | | `KeySignatureType` | Type of `Key signature` (flats, naturals, or sharps) according to modern convention | `key` | | `Mode` | Mode of the `Key` of the piece | `key` | | `NumericTempo` | Numeric tempo of the piece, as defined by the engravers and correctors in the MusicXML files | `tempo` | | `Tempo` | Verbal annotation for the tempo, as defined by the composer | `tempo` | | `TempoGrouped1` | Classification of `Tempo` according to the main term in the verbal annotation | `tempo` | | `TempoGrouped2` | Classification of `Tempo` in Slow, Moderate, or Fast | `tempo` | | `.+_Density` | Density, calculated as no. of notes on the score, family, sound or part / (`Measures` * no. of parts) | `density` | | `.+_SoundingDensity` | Sounding density, calculated as the mean of no. of notes of each part / `Measures` in which the part is sounding | `density` | | `Harmony_Analysis_Available` | Boolean indicating if feature about harmonic analysis coming from MuseScore files has been extracted or not (e.g. if MuseScore file is not available) | `harmony` | | `Harmony_Chord_.+_Count` | No. of `.+` harmonic annotations in the aria, as included in the "Chord" column of the harmonic data | `harmony` | | `Harmony_Chord_.+_Per` | % of `.+` harmonic annotations in the aria, as included in the "Chord" column of the harmonic data | `harmony` | | `Harmony_Chord_types_.+` | % of harmonic annotations of the [major triad, dim., aug., etc.] type in the aria, as included in the "ChordType" column of the harmonic data and completed by our function | `harmony` | | `Harmony_Chords_Grouping_1.+_Count`| No. of chords performig the [T, SD, D, etc.] function in the piece, as determined by the Ruiemannian classification function; it distinguishes between minor and major functions | `harmony` | | `Harmony_Chords_Grouping_1.+_Per` | % of chords performig the [T, SD, D, etc.] function in the piece, as determined by the Riemannian classification function; it distinguishes between minor and major functions | `harmony` | | `Harmony_Chords_Grouping_2.+_Count`| No. of chords performig the [T, SD, D, etc.] function in the piece, as determined by the Riemannian classification function; it does not distinguish between minor and major | `harmony` | | `Harmony_Chords_Grouping_2.+_Per` | % of chords performig the [T, SD, D, etc.] function in the piece, as determined by the classification function; it does not distinguish between minor and major | `harmony` | | `Harmony_HarmonicRhythm` | Harmonic rhythm of the piece, calculated as no. of harmonic annotations / `Measures` | `harmony` | | `Harmony_HarmonicRhythmBeats` | Harmonic rhythm of the piece by beats, calculated as no. of harmonic annotations / `Measures` * no. of beats per measure (depends on $TimeSignature; we use a function) | `harmony` | | `Harmony_Key_.+_PercentageMeasures`| % of measures that are in a given key, extracted from the LocalKey column in the harmonic df | `harmony` | | `Harmony_Key_Modulatory_(b\|#)?\d` | % of sections that are in a given key, extracted from the LocalKey column in the harmonic df | `harmony` | | `Harmony_Key_Modulatory_.+` | % of sections that are in a given key playing the [T, SD, D, etc.] harmonic function, as determined by grouping `Harmony_Key_Modulatory_[Roman numeral]` according to the Riemannian function | `harmony` | | `Harmony_Numerals_.+_Count` | No. of `.+` harmonic annotations in the aria, as included in the "Numeral" column of the harmonic data | `harmony` | | `Harmony_Numerals_.+_Per` | % of `.+` harmonic annotations in the aria, as included in the "Numeral" column of the harmonic data | `harmony` | | `Harmony_Additions_.+` | % of chords with additions (+9,+4+6) | `harmony` | | `.+_Asc_avg_step_.+_win_.+` | 1. given the array of a part used in `.+_Spe_avg_abs_step_.+_win_.+` for a step *S*, take a sliding window of size *W*; 2. compute the average on each window, i.e. the average pitch in a window; 3. define a "chunk" as a sequence of windows having average pitch increasing or decreasing strictly and monotonically; this feature is the average number of windows in the ascending chunks. Window sizes *W* are defined in `musif.extract.features.melody.constants.MOTION_WINS`. | `melody` | | `.+_Acc_avg_abs_step_.+_win_.+` | Same as `.+_Spe_avg_abs_step_.+_win_.+` but uses second-order discrete finite difference (i.e. second-order discrete derivative) | `melody` | | `.+_Asc_prp_step_.+_win_.+` | Number of ascending chunks over the total number of identified chunks (see `.+_Asc_avg_step_.+_win_.+`) | `melody` | | `.+_Dsc_avg_step_.+_win_.+` | This is like `.+_Asc_avg` but for descending chunks | `melody` | | `.+_Dsc_prp_step_.+_win_.+` | Number of descending chunks over the total number of identified chunks (see `.+_Asc_avg_step_.+_win_.+`) | `melody` | | `.+_Spe_avg_abs_step_.+_win_.+` | 1. represent each note as an array with *N* numbers having as value the note's MIDI pitch; here, *N* is the number of *k* notes of duration *S* that fill the whole note duration; 2. represent a melody part as the concatenation of such arrays; 3. take the discrete finite difference of the array for a specific part and divide step *S*; 4. this feature is the absolute mean of such an array. Step sizes *S* are defined in `musif.extract.features.melody.constants.MOTION_STEPS`. | `melody` | | `.+_AverageDuration` | Average duration of the note values in a given part/sound/family/score (quarter note = 1, eighth note = 0.5, etc.) | `rhythm` | | `.+_DottedRhythm` | No. of beats with dotted rhyhm in a given part/sound/family/score / (`SoundingMeasures` * no. of beats of the `TimeSiggnature`) in the part/sound/family/part | `rhythm` | | `.+_DoubleDottedRhythm` | No. of beats with doubly dotted rhyhm in a given part/sound/family/score / (`SoundingMeasures` * no. of beats of the `TimeSignature`) in the part/sound/family/part | `rhythm` | | `.+_RhythmInt` | Sum of the duration of the notes / (`.+_SoundingMeasures` * no. of beats of the TimeSignature) | `rhythm` | | `.+Degree(b+\|#\|x)?\d_Count` | No. of notes in a given part/sound/family/score corresponding to the `.+` scale degree in relation to the main key of the piece; removed after postprocessing | `scale` | | `.+Degree(b+\|#\|x)?\d_Per` | % of `.+_Degree[Arabic numeral]_Count` | `scale` | | `.+Degree(b+\|#\|x)?\d_Count` | No. of notes in a given part/sound/family/score corresponding to the `.+` scale degree in relation to the local key of the passage in which the note is inserted; removed after postprocessing | `scale` | | `.+Degree(b+\|#\|x)?\d_Per` | % of `.+_Degree[Arabic numeral]_Count_relative` | `scale` | | `.+_Degree.+_Count` | No. of notes in a given part/sound/family/score corresponding to [asc, desc, nat, dasc, ddesc] scale degrees in relation to the main key of the piece; removed after postprocessing | `scale` | | `.+_Degree.+_Per` | % of `.+_Degree_[string]_Count` | `scale` | | `.+_Degree.+_Count_relative` | No. of notes in a given part/sound/family/score corresponding to `.+` scale degrees in relation to the local key of the piece; removed after postprocessing | `scale` | | `.+_Degree.+_Per_relative` | % of `.+_Degree_[string]_Count_relative` | `scale` | | `.+_DynAbruptness` | Sum of absolute values of ((Dynamic marking 2 - dynamic marking 1) / no. of beats for dyn marking 1) divided into the no. of total beats in the score/sound/family/part | `dynamics` | | `.+_DynGrad` | Sum of absolute values of ((Dynamic marking 2 - dynamic marking 1) / no. of beats for dyn marking 1) divided into the no. of dynamic markings - 1 in the score/sound/family/part | `dynamics` | | `.+_DynMean` | Sum of all the dynamic values of that part/sound/family/score / no. of dynamic indications in the score/sound/family/part | `dynamics` | | `.+_DynMean_weighted` | Sum of dynamic value * no. of beats in which it is present / (`.+_SoundingMeasures` * no. of beats of the TimeSig) in the score/sound/family/part | `dynamics` | | `.+_Ambitus` | Ambitus of the part/sound/family/score, in number of semitones | `ambitus` | | `.+_HighestNoteIndex` | MIDI pitch of the highest note in the given score/family/sound/part | `ambitus` | | `.+_LowestNoteIndex` | MIDI pitch of the lowest note in the given score/family/sound/part | `ambitus` | | `.+_HighestNote` | Highest note in the score/part/sound | `ambitus` | | `.+_LowestNote` | Lowest note in the score/part/sound | `ambitus` | | `.+_IntervallicKurtosis` | Kurtosis of the interval sizes (difference between the MIDI pitch of two notes) in a given part/sound/family/score | `melody` | | `.+_IntervallicStd` | Std of the interval sizes (difference between the MIDI pitch of two notes) in a given part/sound/family/score | `melody` | | `.+_IntervallicMean` | Mean of the interval sizes (difference between the MIDI pitch of two notes) in a given part/sound/family/score | `melody` | | `.+_IntervallicSkewness` | Skewness of the interval sizes (difference between the MIDI pitch of two notes) in a given part/sound/family/score | `melody` | | `.+_IntervallicTrimDiff` | `.+_TrimmedIntervallicMean` - `.+_IntervallicMean` | `melody` | | `.+_IntervallicTrimRatio` | `.+_TrimmedIntervallicMean` / `.+_IntervallicMean` | `melody` | | `.+_AbsoluteIntervallicKurtosis` | Kurtosis of the absolute interval sizes (in no. of semitones) in a given part/sound/family/score | `melody` | | `.+_AbsoluteIntervallicMean` | Mean of the absolute interval sizes (in no. of semitones) in a given part/sound/family/score | `melody` | | `.+_AbsoluteIntervallicSkewness` | Skewness of the absolute interval sizes (in no. of semitones) in a given part/sound/family/score | `melody` | | `.+_AbsoluteIntervallicStd` | Std of the absolute interval sizes (in no. of semitones) in a given part/sound/family/score | `melody` | | `.+_AbsoluteIntervallicTrimDiff` | `.+_AbsoluteTrimmedIntervallicMean` - `.+_AbsoluteIntervallicMean` | `melody` | | `.+_AbsoluteIntervallicTrimRatio` | `.+_AbsoluteTrimmedIntervallicMean` / `.+_AbsoluteIntervallicMean` | `melody` | | `.+_TrimmedAbsoluteIntervallicMean`| Mean of the absolute interval sizes (in no. of semitones) in a given part/sound/family/score, discarding 10% of the most extreme data | `melody` | | `.+_TrimmedAbsoluteIntervallicStd` | Std of the absolute interval sizes (in no. of semitones) in a given part/sound/family/score, discarding 10% of the most extreme data | `melody` | | `.+_TrimmedIntervallicMean` | Mean of the interval sizes (in no. of semitones, positive and negative) in a given part/sound/family/score, discarding 10% of the most extreme data | `melody` | | `.+_TrimmedIntervallicStd` | Std of the interval sizes (in no. of semitones, positive and negative) in a given part/sound/family/score, discarding 10% of the most extreme data | `melody` | | `.+_AscendingIntervallicMean` | Mean of the sizes of the ascending intervals (in no. of semitones) in a given part/sound/family/score | `melody` | | `.+_AscendingIntervallicStd` | Std of the sizes of the ascending intervals (in no. of semitones) in a given part/sound/family/score | `melody` | | `.+_DescendingIntervallicMean` | Mean of the sizes of the descending intervals (in no. of semitones) in a given part/sound/family/score | `melody` | | `.+_DescendingIntervallicStd` | Std of the sizes of the descending intervals (in no. of semitones) in a given part/sound/family/score | `melody` | | `.+_AscendingIntervals_Count` | No. of ascending intervals in a given part/sound/family/score | `melody` | | `.+_AscendingIntervals_Per` | % of `.+_AscendingIntervals_Count` | `melody` | | `.+_DescendingIntervals_Count` | No. of descending intervals in a given part/sound/family/score | `melody` | | `.+_DescendingIntervals_Per` | % of `.+_DescendingIntervals_Count` | `melody` | | `.+_Interval.+_Count` | No. of `.+` intervals in a given score/family/sound/part | `melody` | | `.+_Interval.+_Per` | % of `.+_Interval.+_Count` | `melody` | | `.+_Intervals.+Asc_Count` | No. of ascending intervals of a `.+` type in a given part/sound/family/score | `melody` | | `.+_Intervals.+Asc_Per` | % of `.+_Intervals.+Asc_Count` | `melody` | | `.+_Intervals.+Desc_Count` | No. of descending intervals of a `.+` type in a given part/sound/family/score | `melody` | | `.+_Intervals.+Desc_Per` | % of `.+_Intervals.+Desc_Count` | `melody` | | `.+_Intervals.+All_Count` | No. of intervals of a `.+` type in a given part/sound/family/score | `melody` | | `.+_Intervals.+All_Per` | % of `.+_Intervals.+All_Count` | `melody` | | `.+_StepwiseMotion.+_Count` | No. of [asc, desc, all] stepwise intervals in a given part/sound/family/score (stepwise motion: the two notes of the interval are step apart) | `melody` | | `.+_StepwiseMotion.+_Per` | % of `.+_StepwiseMotion.+_Count` | `melody` | | `.+_Leaps.+_Count` | No. of [asc, desc, all] leaps in a given part/sound/family/score (leap: interval of a 3rd or larger) | `melody` | | `.+_Leaps.+_Per` | % of `.+_Leaps.+_Count` | `melody` | | `.+_Repeatedno.es_Count` | No. of consecutively repeated notes in a given part/sound/family/score | `melody` | | `.+_Repeatedno.es_Per` | % of `.+_Repeatedno.es_Count` | `melody` | | `.+AscendingSemitones_Sum` | Sum of all the ascending intervals, counted as semitones, in a given part, family, or score | `melody` | | `.+DescendingSemitones_Sum` | Sum of all the descending intervals, counted as semitones, in a given part, family, or score | `melody` | | `.+_LargestAbsoluteSemitones.+` | Largest [asc, desc, all] interval in the part/sound/family/score, in number of semitones, disregarding the direction | `melody` | | `.+_LargestSemitones.+` | Largest [asc, desc, all] interval in the part/sound/family/score, in number of semitones, taking into account the direction | `melody` | | `.+_LargestInterval.+` | Largest [asc, desc, all] interval in the part/sound/family/score, as a string provided by `music21` | `melody` | | `.+_SmallestAbsoluteSemitones.+` | Smallest [asc, desc, all] interval in the part/sound/family/score, in number of semitones, disregarding the direction | `melody` | | `.+_SmallestSemitones.+` | Smallest [asc, desc, all] interval in the part/sound/family/score, in number of semitones, taking into account the direction | `melody` | | `.+_SmallestInterval.+` | Smallest [asc, desc, all] interval in the part/sound/family/score, as a string provided by `music21` | `melody` | | `.+_MeanInterval` | Mean interval of the part/sound/family/score, given as interval name | `melody` | | `Score_VoiceReg` | Mean of (MIDI pitch of the note - MIDI pitch of the last note in the vocal part) | `lyrics` | | `.+_Syllables` | No. of syllables in a given vocal part, as introduced by the music engraver | `lyrics` | | `.+_SyllabicRatio` | Mean of (no. of notes / no. of syllables) in each vocal part | `lyrics` | | `.+_VoicePresence` | `.+_SoundingMeasures` / `Measures` for each singer in the score | `lyrics` | | `Presence_of_.+` | Inclusion of a given part on the score | added if `separate_instrumentation_column` is `true` in the `DataProcessor` configuration (default: `false`) | | `Part.+\|Part.+_Texture` | No. of notes of Part[1] / no. of notes of Part[2] | `texture` |