1. Design an abstract data type in Java which represents a musical pitch (NoteADT.java). The ADT must store the note or pitch as an integer value. In this case, the ADT must be developed as an abstract class rather than an interface.
A pitch or a note can be completely specified as:
a) A number of cycles per second (or hertz, abbreviated “Hz”),
b) The number of half steps above a commonly agreed-upon pitch, like A (in modern times, considered to be 440Hz). It is generally referred as a concert pitch since it is the reference pitch that the members of orchestra (and most other professional musicians) tune to before they perform.
c) The common music note (C, D, E, F, G, A, B) with suffix indicating the octave number [-1, 9] and an additional suffix prefix ‘#’ for sharp notes and ‘b’ for flat notes (a ‘b’ will lower a note by a half-step). For ex, C4# or C#4 or D4b or Db4 is the C-sharp note of the 4th octave, and A6 is the A of the 6th octave.
d) The MIDI absolute note number ranging from [0, 127]
e) Higher pitches have higher frequencies. Two pitches are an octave (12 semitones) apart if one has a frequency two times the other. A half-step or semitone increase in pitch is 12√2 = 1.06 times higher.
f) Your pitch constructors must admit a frequency (a double) as in 1a), or a number of half-steps (an int) above or below the concert pitch as in 1b) or a music note (a String) as in 1c). Imperfect frequencies should be tuned to the nearest half pitch.
g) Once constructed, a pitch must be capable to provide its frequency in either cycles per second or half-steps or MIDI absolute numbers.
h) It must be probable to compare the notes using the Comparable interface, to find out if the two notes form an octave and to raise or lower the note by the number of semi-tones.