amads.pitch.pcdist2

amads.pitch.pcdist2#

This module provides the pcdist2 function.

Original doc: https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=6e06906ca1ba0bf0ac8f2cb1a929f3be95eeadfa#page=81.

amads.pitch.pcdist2.pcdist2(score, weighted=True) list[list[float]][source]#

Returns the 2nd order pitch-class distribution of a musical score.

Args:

score (Score): The musical score to analyze. weighted (bool, optional): If True, the pitch-class distribution is

weighted by note durations.

Returns:
list[list[float]]: A 12x12 matrix where PCD[i][j] represents the

probability of transitioning from pitch class i to j. The pitch classes are (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.

Parameters:

score (Score)

Return type:

list[list[float]]

amads.pitch.pcdist2.update_pcd(pcd, notes, weighted)[source]#

Updates the pitch-class distribution matrix based on the given notes.

Serves as a helper function for pcdist2

Args:
pcd (list[list[float]]): The pitch-class distribution matrix to be

updated.

notes (list[Note]): The list of notes to process. weighted (bool, optional): If True, the pitch-class distribution is

weighted by note durations.

Parameters:
  • pcd (list[list[float]])

  • notes (list[Note])

  • weighted (bool)