amads.pitch.ivdist2

amads.pitch.ivdist2#

Provides the ivdist2 function

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

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

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

Currently, intervals greater than an octave will be ignored.

Args:

score (Score): The musical score to analyze weighted (bool, optional): If True, the interval distribution is

weighted by note durations (default True)

Returns:
list[list[float]]: A 25x25 matrix where (i,j) represents the normalized

probabilities of transitioning from interval i to interval j. Refer to the documentation for ivdist1 for the index of each interval. If the score is empty, the function returns a matrix with all elements set to zero.

Raises:

Exception: If the score is not monophonic (e.g. contains chords)

Parameters:

score (Score)

Return type:

list[list[float]]

amads.pitch.ivdist2.update_id(id, notes, weighted)[source]#

Updates the interval distribution list based on the given notes.

Serves as a helper function for ivdist2

Args:

id (list[list[float]]): The interval distribution list to be updated. notes (list[Note]): The list of notes to process. weighted (bool): If True, the interval distribution is weighted

by note durations.

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

  • notes (list[Note])

  • weighted (bool)