2

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

BabaNew
  • 884
  • 1
  • 13
  • 27
  • Intervals takes a string in its constructor with numbers indicating intervals, and flats and sharps. For example, Scale MAJOR = new Scale(new Intervals("1 2 3 4 5 6 7")) - that's easy enough - and Scale.MINOR = new Scale(new Intervals("1 2 b3 4 5 b6 b7")) - some flats in there because the minor scale has a minor 3rd, 6th, and 7th. Scale.CIRCLE_OF_FIFTHS = new Scale(new Intervals("1 2 3b 4 5 6 7b")). – David Koelle Oct 27 '21 at 02:20

1 Answers1

2

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!

David Koelle
  • 20,726
  • 23
  • 93
  • 130
  • 1
    I am a big fan of the library in general and i am just grateful that there is such a library! If you feel that something can be improved, i think that you are the one that can make the best observations about it, given that you are the one that deeply knows it. There is only one thing that i have noticed, but it concerns the tempos: Pretissimo does not exists in italian. It should be Prestissimo. – BabaNew Oct 27 '21 at 13:31
  • 1
    Thank you for being a fan :) – David Koelle Oct 27 '21 at 17:31