|We are producing music analysis software. We have already broken the sensor
data into a sequence of beats, with the
loudness of each beat known.Your project is to divide the beats into
measures. Each measure
consists of adjacent beats, and each beat must be in exactly one measure. The number of beats per measure must be between 2 and 10, inclusive, and be the same for all measures.
The heuristic that has been chosen is to divide the beats into measures based upon the idea that the first beat in each measure tends to be stressed. The data does not necessarily begin or end with a full measure, so if you decide on k beats per measure then the first full measure may begin at any of the first k beats in the loudness data. The primary requirement is that at least 80% of the full measures must have the loudness of their first beat at least as big as the loudness of each of the other beats in that measure. It is also required that there must be at least one full measure.
Create a class Measures that contains a method beatsPerM that is given a int loudness giving the loudness of each beat. It returns the smallest acceptable number of beats per measure. Return -1 if no value between 2 and 10 inclusive satisfies the requirements.
|-||loudness will contain between 2 and 50 elements, inclusive.|
|-||Each element of loudness will be between 0 and 100, inclusive.|