Search code examples
jfugue

Transposing the key using jfugue - Some questions concerning Jfugue



I have a couple of questions concerning JFugue (5, the beta version).

  • From The complete guide to JFugue, it is mentioned that depending on the Key Signature in the pattern, JFugue interprets the note value. As an example, in the case of an F-major key, B would be automatically translated to B-flat, unless we write "Bn" instead. The question is that if we are dealing with an F major key and write "Bb" how would JFugue interpret it ? As "Bbb" or as a "Bb" note ?
  • My second question is about transposing Keys in JFugue.
    What is the fastest way of doing so ?

Thank you for your help,
Best Regards,
Hussein Hammoud.


Solution

  • Answer to the first part of your question: In the key of F-Major, Bb is played like Bb, the same as B itself when played in F-Major. Here's a program that tests this:

    StaccatoParser parser = new StaccatoParser();
    DiagnosticParserListener dpl = new DiagnosticParserListener();
    parser.addParserListener(dpl);
    Pattern pattern = new Pattern("KEY:Cmaj B Bn Bb   KEY:FMaj B Bn Bb");
    parser.parse(pattern);
    

    And its output (note that MIDI Note 70 is Bb and MIDI Note 71 is B):

    Before parsing starts
    Key signature parsed: key = 0  scale = 1
    Note parsed: value = 71  duration = 0.25  onVelocity = 64  offVelocity = 64
    Note parsed: value = 71  duration = 0.25  onVelocity = 64  offVelocity = 64
    Note parsed: value = 70  duration = 0.25  onVelocity = 64  offVelocity = 64
    Key signature parsed: key = 5  scale = 1
    Note parsed: value = 70  duration = 0.25  onVelocity = 64  offVelocity = 64
    Note parsed: value = 71  duration = 0.25  onVelocity = 64  offVelocity = 64
    Note parsed: value = 70  duration = 0.25  onVelocity = 64  offVelocity = 64
    After parsing finished
    

    Answer to the second part of your question: I'm not sure there's a decent answer right now. But you have inspired me to write a transpose() method on the Pattern class. Thank you!