I'm writing a JSFX effect that sends note-off messages early when articulations are encountered in the notation editor. For example, forcing notes with a staccato mark to be no longer than n milliseconds.
The code below is how I pull the note information from notation if the articulation is found. The MIDI string is #string.
Code:
match("%{foo}s*"
" ""%1-2{channel}d*"
" ""%1-3{notenum}d*"
,#string);
The code works as expected for most articulations. In the example below, channel receives a value of 0 and notenum receives a value of 62:
Code:
"NOTE 0 62 articulation staccato"
However, things get messed up when I add a slur into the mix. The example below returns a channel value of 0 (good) and a note value of 1 (not good).
Code:
"NOTE 0 62 articulation staccato phrase 1 slur begin"
Clearly, the notenum line of my code is capturing the third numeric found and not the second, but I'm not sure why. Any ideas?