javamidijavax.sound.midijfugue

JFugue parser exception in the value of duration, in the case of 'notes sharing same duration'


I'm working with JFugue , when i tried to execute the code

Player myPlayer = new Player();
myPlayer.play( ":DEFAULT(duration=.25)");  
Pattern test=new Pattern(" m327.0  m348.8  ( m392.4/0.25  m413.393 m392.4 )/0.5 m348.8 ");
myPlayer.play(test);

I'm getting a Parser exception,The character, parsed as a note velocity, is not recognized: : 0

when i remove the 0 from ')/0.5' , it works properly

Pattern test=new Pattern(" m327.0  m348.8  ( m392.4/0.25  m413.393 m392.4 )/.5 m348.8 "); 

The same exception is showing for all values greater than or equal to 1(for eg: ')/1.5' ) But, I noticed that m392.4/0.25 is working without any problem.


Solution

  • The problem is in here:

    ( m392.4/0.25  m413.393 m392.4 )/.5
    

    When JFugue parses elements in parentheses, it adds whatever immediately follows the parentheses to each element within the parentheses. In this case, the JFugue parser adds /.5 to each of the microtone elements, giving:

    m392.4/0.25/0.5 m413.393/0.5 m392.4/0.5
    

    Look at that first token. m392.4/0.25/0.5 is not valid; it contains two durations, and JFugue does not know how to interpret this. After successfully parsing the first duration (/0.25), the JFugue parser is now expecting to either see a velocity, a connector (like + or _), or nothing. The error message does seem misleading, so I'll look into that.