#NEWLINE# def get_pitch_class_histogram( self , use_duration = False , use_velocity = False , normalize = True ) : #NEWLINE# #INDENT# 'Computes the histogram of pitch classes given all tracks\n\n        Parameters\n        ----------\n        use_duration : bool\n            Weight frequency by note duration\n        use_velocity : bool\n            Weight frequency by note velocity\n        normalize : bool\n            Normalizes the histogram such that the sum of bin values is 1.\n\n        Returns\n        -------\n        histogram : np.ndarray, shape=(12,)\n            Histogram of pitch classes given all tracks, optionally weighted\n            by their durations or velocities\n        ' #NEWLINE# histogram = sum ( [ i . get_pitch_class_histogram ( use_duration , use_velocity ) for i in self . instruments ] , np . zeros ( 12 ) ) #NEWLINE# if normalize : #NEWLINE# #INDENT# histogram /= ( histogram . sum ( ) + ( histogram . sum ( ) == 0 ) ) #NEWLINE# #UNINDENT# return histogram