I am trying to write a simple parser to read MusicXML and play it back. I am using JFugue 5.0.3. The library simply hangs in the middle half the time.
My code:-
public void play() throws ParserConfigurationException, ParsingException, IOException {
MusicXmlParser_J parser_j = new MusicXmlParser_J();
StaccatoParserListener listener = new StaccatoParserListener();
parser_j.addParserListener(listener);
parser_j.parse(musicXMLFile);
Player player = new Player();
final Pattern musicXMLPattern = listener.getPattern();
player.play(musicXMLPattern);
}
This code fails after attempting to build MusicXML file with a useless error message:-
attempting to build file
Oops something went wrong. The error isConnection timed out
and it works sometimes and when it does it works like a charm and within milliseconds. What is JFugue trying to download stuff over the network? A little debugging revealed it works by downloading
Few questions to the people who work on this :-
Why doesn't this code work with MusicXMLParserListener class? This class fails with an arbitrary null pointer exception because it expects Staccato parser to be defined. Why? And what is the deal with two different listeners for MusicXML - MusicXMLParserListener_J and MusicXMLParserListener_R? Don't expose broken stuff to consumers please.
I had read that JFugue supports MusicXML and I expected this to work without an issue.
Are there examples of JFugue working with MusicXML?