public static double note(String aNote,int aOctave){
  int i;
  double freq;
  int enharmonic=0;
  aNote=aNote.toUpperCase();
  i=aNote.indexOf(FLAT);
  if (i > -1) {
    aNote=aNote.substring(i - 1,1);
    enharmonic=-1;
  }
  i=aNote.indexOf(SHARP);
  if (i > -1) {
    aNote=aNote.substring(i - 1,1);
    enharmonic=1;
  }
  freq=getOctaveIndex(aNote,enharmonic);
  if (aOctave == 4) {
    return freq;
  }
 else {
    int d=aOctave - 4;
    int j=Math.abs(d);
    for (i=0; i < j; ++i) {
      if (d > 0)       freq*=2;
 else       freq*=.5;
    }
    return freq;
  }
}

public static double note ( String aNote , int aOctave ) { int i ; double freq ; int enharmonic = 0 ; aNote = aNote . toUpperCase ( ) ; i = aNote . indexOf ( FLAT ) ; if ( i > - 1 ) { aNote = aNote . substring ( i - 1 , 1 ) ; enharmonic = - 1 ; } i = aNote . indexOf ( SHARP ) ; if ( i > - 1 ) { aNote = aNote . substring ( i - 1 , 1 ) ; enharmonic = 1 ; } freq = getOctaveIndex ( aNote , enharmonic ) ; if ( aOctave == 4 ) { return freq ; } else { int d = aOctave - 4 ; int j = Math . abs ( d ) ; for ( i = 0 ; i < j ; ++ i ) { if ( d > 0 ) freq *= 2 ; else freq *= .5 ; } return freq ; } }
generates the frequency in hz corresponding to the given note at the given octave
