/******************************************************************************/
// There are 128 notes dictated by the MIDI 1.0 specification, starting at 0,
// which is C-2.  This simple program will print each MIDI note's numerical
// value and its musical note mapping and range.
//
// Roy Vanegas: rvanegas@hunter.cuny.edu
/******************************************************************************/

public class PrintMIDINoteArray
{
   public static void main( String[] args )
   {
      int octave = -2;
    
      String[] notes = { "C", "C#/Db", "D", "D#/Eb", "E", "F", 
                         "F#/Gb", "G", "G#/Ab", "A", "A#/Bb", "B" };
    
      for( int midiNote = 0; midiNote < 128; midiNote++ )
      {
         if( (midiNote % 12 == 0) && (midiNote != 0) )
         {
            ++octave;
            System.out.println();
         }

         // MIDI note 60 is middle C
         System.out.println( midiNote == 60 ? 
            ("MIDI note " + midiNote + " is " + 
               notes[ (midiNote % 12) ] + octave + " (middle C)" ) :
            ("MIDI note " + midiNote + " is " + 
               notes[ (midiNote % 12) ] + octave ) );
      }
    
      System.out.println();
   }
}
