# Metrics¶

MusPy provides several objective metrics proposed in the literature, summarized as follows.

• Pitch-related metrics: pitch_range, n_pitches_used, n_pitch_classes_used, polyphony, polyphony rate, pitch-in-scale rate, scale consistency, pitch entropy and pitch class entropy.

• Rhythm-related metrics: empty-beat rate, drum-in-pattern rate, drum pattern consistency and groove consistency.

• Other metrics: empty_measure_rate.

These objective metrics could be used to evaluate a music generation system by comparing the statistical difference between the training data and the generated samples.

## Other metrics¶

muspy.empty_measure_rate(music, measure_resolution)[source]

Return the ratio of empty measures.

The empty-measure rate is defined as the ratio of the number of empty measures (where no note is played) to the total number of measures. Note that this metric only works for songs with a constant time signature. Return NaN if song length is zero. This metric is used in [1].

$empty\_measure\_rate = \frac{\#(empty\_measures)}{\#(measures)}$
Parameters
Returns

Empty-measure rate.

Return type

float

muspy.empty_beat_rate()