Pitch Distributions
pitch_class_distribution_1
¶
pitch_class_distribution_1(
score: Score,
name: str = "Pitch Class Distribution",
weighted: bool = True,
miditoolbox_compatible: bool = False,
) -> Distribution
Calculate the pitch-class distribution of a note collection.
Parameters:
-
score(Score) –The musical score to analyze
-
name(str, default:'Pitch Class Distribution') –Name for the distribution; plot title if plotted.
-
weighted(bool, default:True) –If True, weight the pitch-class distribution by note durations in seconds that are modified according to Parncutt's durational accent model (1994), by default True.
-
miditoolbox_compatible(bool, default:False) –Matlab MIDI Toolbox avoids zero division by dividing counts by the total count plus (1e-12 times the number of bins). True enables this behavior. Default is False, which simply skips division when the total count is zero (this also returns a zero matrix when the count is zero).
Returns:
-
Distribution–A 12-element distribution representing the probabilities of each pitch class (C, C#, D, D#, E, F, F#, G, G#, A, A#, B). If the score is empty, the function returns a list with all elements set to zero.
Source code in amads/pitch/pcdist1.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
pitch_class_distribution_2
¶
pitch_class_distribution_2(
score: Score,
name: str = "Pitch Class Distribution",
weighted: bool = True,
miditoolbox_compatible: bool = False,
) -> Distribution
Returns the 2nd order pitch-class distribution of a musical score.
Parameters:
-
score(Score) –The musical score to analyze
-
name(str, default:'Pitch Class Distribution') –Name for the distribution; plot title if plotted.
-
weighted(bool, default:True) –If True, weight the pitch-class distribution by note durations in seconds that are modified according to Parncutt's durational accent model (1994), by default True.
-
miditoolbox_compatible(bool, default:False) –Matlab MIDI Toolbox avoids zero division by dividing counts by the total count plus (1e-12 times the number of bins). True enables this behavior. Default is False, which simply skips division when the total count is zero (this also returns a zero matrix when the count is zero).
Returns:
-
Distribution–A 12x12 distribution representing the transition probabilities of each pitch class (C, C#, D, D#, E, F, F#, G, G#, A, A#, B). If the score is empty, the function returns a distribution with all elements set to zero.
Source code in amads/pitch/pcdist2.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
pitch_mean
¶
pitch_mean(score, weighted=False)
Compute the mean pitch or mean pitch weighted by duration (in quarters)
Parameters:
-
score(Score) –The pitch mean is computed for all pitches in the score. Groups of two or more tied notes are counted as one pitch occurrence.
-
weighted(bool, default:False) –If true, pitches are weighted by their durations.
Source code in amads/pitch/pitch_mean.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |