Search code examples
javajfugue

how to slur notes with jfugue


I am trying to play a series of about 200 pitches in succession using jfugue. The notes all play but it is choppy. Is it possible to have the notes play in a smooth way, like an instrument slurring two notes?


Solution

  • If your pitches span multiple octaves, you will necessarily need to trigger new MIDI Note On events for those notes. (If your 200 pitches are within a semitone of each other, you can use the Pitch Wheel). Since you need to trigger new notes, you will hear the notes going on and off, unless you can set note on / note off velocities in such a way that this is not noticeable. You may also be able to pick an instrument that lends itself to smooth playing (for example, maybe Flute, but not Piano).

    If you don't want to list each of those 200 pitches yourself, you can write a new JFugue function, say ":SLUR", that might take the starting note value, the ending note value, the total duration, and the number of steps to hear during the duration. Your function might create all of the microtones between the two notes. Then you could call the microtone preprocessor to turn the microtones into pitch wheel and note events.

    Once you add your SlurFunction to the preprocessor context (see StaccatoParser.java), you'd be able to say:

    // Start with Note 20, end at Note 80, 
    // play for 2.5 * whole durations, and hear 20 steps in between. 
    // (Be sure there are no spaces in your function call)
    new Player().play(":SLUR(20,80,2.5,20)"); 
    

    Writing a new function in JFugue is powerful but definitely an advanced feature. If you're interested, see the TrillFunction example in the source code.