jfugue

JFugue: Get notes of a specific scale


What is the correct way to retrieve the notes that belong to a scale in JFugue, for example C maj?

I have seen there is this class org.jfugue.theory.Intervals but i don't understand what i should pass as constructor parameter


Solution

  • The following code snippet starts with a Major scale, gets the intervals from the scale (intervals being the steps between each of the notes in the scale), sets the root to C (so now you have a C Major), and get the notes that belong in C Major.

     List<Note> notes = Scale.MAJOR.getIntervals().setRoot("C").getNotes();
    

    As I type this, it feels like the 'getIntervals' call is not meaningful. When I wrote this all, I was trying to figure out if there is an actual distinction between intervals and a scale, aside from the fact that those two words aren't used exactly interchangeably. If you have feedback on this, please let me know!