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?
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).
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.
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)):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.