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: muspy.music.Music, measure_resolution: int) → float[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:
  • music (muspy.Music) – Music object to evaluate.
  • measure_resolution (int) – Time steps per measure.
Returns:

Empty-measure rate.

Return type:

float

See also

muspy.empty_beat_rate()
Compute the ratio of empty beats.

References

  1. Hao-Wen Dong, Wen-Yi Hsiao, Li-Chia Yang, and Yi-Hsuan Yang, “MuseGAN: Multi-track sequential generative adversarial networks for symbolic music generation and accompaniment,” in Proceedings of the 32nd AAAI Conference on Artificial Intelligence (AAAI), 2018.