Absolute pitch
Full module path: melody_features.feature_definitions.absolute_pitch.
Also importable via import melody_features as mf (for example mf.pitch_range).
Absolute pitch feature definitions.
- pitch_range(pitches)[source]
Subtract the lowest pitch number in the melody from the highest.
- Parameters:
- Returns:
Range between highest and lowest pitch in semitones
- Return type:
Note
This feature is named ambitus in MIDI Toolbox.
- basic_pitch_histogram(pitches)[source]
A histogram of pitch values and their counts, with one pitch bin per non-zero count.
- Parameters:
- Returns:
Mapping from MIDI pitch (0–127) to note count. Only pitches with count > 0 are included.
- Return type:
Note
We only return bins for pitches that have a count > 0. An implementation that is truer to the original jSymbolic implementation would return 128 bins (0-127) regardless of how any different pitches are present. However, we believe our approach is more concise and easier to understand for many purposes.
- melodic_pitch_variety(pitches, starts, tempo=120.0, ppqn=480)[source]
The average number of onset positions before a pitch is repeated.
- Parameters:
- Returns:
Average number of distinct onset positions before pitch repetition.
- Return type:
- number_of_common_pitches(pitches)[source]
The number of unique pitch numbers that appear in at least 9% of total notes.
- tessitura(pitches)[source]
Tessitura is based on standard deviation from median pitch height. The median range of the melody tends to be favoured and thus more expected. Tessitura predicts whether listeners expect tones close to median pitch height. Higher tessitura values correspond to melodies that have a wider range of pitches.
- prevalence_of_most_common_pitch(pitches)[source]
The proportion of pitches that are the most common pitch with regards to the total number of pitches in the melody.
- relative_prevalence_of_top_pitches(pitches)[source]
The ratio of the frequency of the second most common pitch to the frequency of the most common pitch.
- interval_between_most_prevalent_pitches(pitches)[source]
The number of semitones between the two most prevalent pitches.
- pitch_skewness(pitches)[source]
The skewness of the pitch histogram, using Pearson’s median skewness formula.
- importance_of_bass_register(pitches)[source]
The proportion of pitch numbers in the melody that are between 0 and 54.
- importance_of_middle_register(pitches)[source]
The proportion of pitch numbers in the melody that are between 55 and 72.
- importance_of_high_register(pitches)[source]
The proportion of pitch numbers in the melody that are between 73 and 127.