Music notes - Octave - Code Explanation
Hi;
I have the following code for calculate music notes and an Octave; however, i don't understand it. I appretiated if someone could explain me.
Code:
public class Notes {
public static void main (String [] args) {
String notes = "C C#D D#E F F#G G#A A#B ";
int octave;
String note;
for (int noteNum = 0; noteNum < 128; noteNum++) {
octave = noteNum / 12 - 1;
note = notes.substring(
(noteNum % 12) * 2,
(noteNum % 12) * 2 + 2);
System.out.println (
"Note number " + noteNum +
" is octave " + octave +
" and note " + note);
}
}
}