MidiUtil { public static float midiToFrequency(int m) { return (float)(Math.pow(2,(m-69.0)/12.0)*F_REF); } private  MidiUtil(); static int frequencyToMidi(float frequency); static float midiToFrequency(int m); static void play(Melody melody, int instrument, int channel); static final double F_REF; }
@Test public void testMidiToFrequency() { for (int m=0; m<127; m++) { assertEquals(PITCHES[m], MidiUtil.midiToFrequency(m), 1e-8, "Calculated frequency does not match the expected frequency."); } }