2

当我尝试执行代码时,我正在使用JFugue

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);

我收到解析器异常,无法识别被解析为音符速度的字符::0

当我从 ')/0.5' 中删除 0 时,它可以正常工作

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

对于所有大于或等于 1 的值(例如: ')/1.5' )显示相同的异常但是,我注意到 m392.4/0.25 工作没有任何问题。

4

1 回答 1

1

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.

于 2015-02-23T16:51:35.343 回答