1

How can I do slurs, ties and dynamics in JFugue 5?

Concerning the dynamics, I would like to have them for one pattern until I place another dynamic and I want to set the dynamic volume (for example "mp" | "setVolume(mp=48)" or something that works like this).

Pattern pattern1 = new Pattern();
pattern1.add("C5q. D5i E5q G5q | A5h G5h");
pattern1.add("E5q. F5i E5q D5q | C5w");

Pattern main_voice = new Pattern();
main_voice.add(pattern1);
main_voice.setTempo(120);

Player player = new Player();
player.play(main_voice);

I set the music like this, so I don't want to place the dynamics again in every row. Also, it's possible that slurs and ties must go over more than one line. Is this possible?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Zero
  • 84
  • 8
  • *[slur](https://en.wiktionary.org/wiki/slur#Noun)* - *"5. (music) A set of [notes](https://en.wiktionary.org/wiki/note#Noun) that are played [legato](https://en.wiktionary.org/wiki/legato#Adverb), without separate articulation. 6. (music) The symbol indicating a legato passage, written as an arc over the slurred notes (not to be confused with a tie)."* – Peter Mortensen Jan 19 '23 at 16:52

1 Answers1

0

Durations in JFugue use the dash character to indicate a note that either keeps playing, continues playing, or stops playing, depending on where it is placed in relation to the duration characters. Notice "q-", "-w-", and "-h" in the line below. This must be applied to notes of the same note value (behind the scenes, the - inhibits the MIDI NoteOff or NoteOn calls).

pattern1.add("Ah Gq Cq- | C-w- | C-h Ah");

That would play C for a quarter, whole, and half duration with no interruption.

This next line produces the same music, but the measure characters are nice to have to make the music more readable.

pattern1.add("Ah Gq Cqwh Ah"); // This produces equivalent music but is harder to read

For dynamics that you don't want to add to each line, look into Pattern.addToEachNoteToken(). These examples use durations, but you can use dynamics instead (where 'a' is followed by the on-velocity (0-128) and 'd' is followed by the off-velocity (also 0-128)):

new Pattern("A B C").addToEachNoteToken("a80") // Results in "Aa80 Ba80 Ca80" 
new Pattern("A B C").addToEachNoteToken("a80 a100") // Results in "Aa80 Ba100 Ca80" (rolls back to a80 for third note) 
new Pattern("A B C").addToEachNoteToken("a80d10 a80d90 a100d90") // Results in "Aa80d10 Ba80d90 Ca100d90"

Other than these features, the Staccato string in JFugue was not meant to replicate all of the features of sheet music; it was created to make human-readable music easy to enter and read. So, not all sheet music dynamics are represented in JFugue, although there may be workarounds.

David Koelle
  • 20,726
  • 23
  • 93
  • 130