Search code examples
javajfugue

JFugue semitones between 2 notes


What is the fastest way (if any) to get the semitones between 2 notes in JFugue (vr 5.0.9) ?

For instance, how can i get the number of semitones between F4 and G5?


Solution

  • I think the getValue() method on a Note will give you what you're looking for.

        Note n1 = new Note("F4");
        Note n2 = new Note("G5");
        int semitoneDelta = n2.getValue() - n1.getValue(); 
        System.out.println(semitoneDelta); // returns 14 in this case