MusicXML JMSL Score Importer

The goal of this project is to develop a Java class that parses a MusicXML input stream and builds a JMSL Score object from it.

IMPORTANT:
There are two kinds of XML referenced in this project:
1) MusicXML, developed by Recordare is a standardized music representation XML format, supported by programs like Sibelius and Finale. Visit www.recordare.com
2) JMSL Score XML, is JMSL's own native XML format for saving and loading JMSL Score objects.

Source code:
1) com.algomusic.musicxml.MusicXMLJScoreImporter
This is the main class and is the one that needs to be finished. This is the ultimate deliverable.
It was begun by Nick Didkovsky in 2007, in a skeletal format that simply parsed a MusicXML input stream and built a rudimentary score from it, 
with some System.out notifications when various tags are encountered.
Robby Grodin took over the coding project and continued to develop it through 2011
Adam Siska began working on it in Feb 2011

2) com.algomusic.util.ScoreDiff
This was developed by Nick Didkovsky to help automatically test MusicXMLJScoreImporter
ScoreDiff takes two JMSL Score objects and compares them
Do not develop this source code. If there's a problem with it, notify Nick 

3) com.algomusic.musicxml.MusicXMLParserTestSuite
 Test MusicXML parser on a suite of JMSL Scores
 For each, it:  
  1) loads the JMSL Score to a live Score and keeps it in memory. Call it score1
  2) writes it to a MusicXML file 
  3) Parses the MusicXML file using MusicXMLJScoreImporter and create a second live Score from it, call it score2. 
  4) Run ScoreDiff on score1 versus score2 to see if there are any differences (should be the same)
  


WHAT DO I DO NOW?!?!?!?!? Here's how you should proceed:

I) Quick satisfaction
Import this project into Eclipse.
In Project Properties -> Java Build Path -> Libraries, point jmsl.jar and jscore.jar to the proper location on your machine
Run MusicXMLJScoreImporter as a standalone application in Eclipse.  
It attempts to load the MusicXML file "MusicXML_scores/CScale_musicxml.XML"
You will see a bunch of system.out text and a score will open that shows a C Scale.
Ta-dah!  MusicXML is successfully parsed and has created a JMSL Score!!!
Yay you're done!  Project's over!  

No not really.

II) Make your own MusicXML to test it.
Load the JMSL Score standalone.
Compose a short score that tests a feature you are interested in (noteheads for example).
Export as MusicXML: Score menu -> Export -> MusicXML
Change the filename in MusicXMLJScoreImporter and see if you get the same score back.
Important: make sure your score has all measures filled with proper duration total else all bets are off with MusicXML! 

II) A better way to test: a test suite of scores and automatic diffing.
A better way is to create a suite of JMSL Scores, save them in their native JMSL format and use MusicXMLParserTestSuite to run through them. 
The test suite will load a JMSL score from its native XML format, keep the score live in memory, save as MusicXML, use the parser to import that,
and create a second score in memory, then finally use ScoreDiff to compare the two scores in memory.
IMPORTANT: we are not diffing the MusicXML file with the native JMSL XML file!  We are diffing two LIVE JMSL Scores: one loaded from the 
native JMSL score file, and the other loaded from the MusicXML importer!  If they are identical then you're good. 
Any differences are written to a log. This will save your eyes and your brain from looking for differences!

There are 5 scores already in a folder called "xml_score_testsuite"
Go ahead and run MusicXMLParserTestSuite as a standalone. It will load each file found in the "xml_score_testsuite" folder
For each, it will write a diff report to logs/inputscorefilename.LOG
It's really cool!  
For example, look at BinaryDurationsAndDots.zip.LOG after you run it. You will see that time sig is not imported properly, because at the top of
the log file it says:
QUOTE
	TEST: BinaryDurationsAndDots.zip
	measure 4 timesig differs 6 4 != 4 4
ENDQUOTE
Here we see that the original score, measure 4, has a time sig of 6/4 but the MusicXML importer did not pick that up. Boo.  
It's written to the MusicXML ok, but the importer is not parsing time signatures. 
This would be a good place for you to start: supporting time signature changes.

If you want to see what the score should look like, run the JMSL Score standalone and load file xml_score_testsuite/BinaryDurationsAndDots.zip
If you want to prove that the MusicXML was correctly written by JMSL, export it from JMSL Score standalone as MusicXML and load that into Finale

4) Every so often you'll want to get a reality shock/check and try importing one of Recordare's MusicXML score examples, and see how much is 
not supported yet. Brace yourself. 
NOTE: there's a lot of MusicXML that JMSL Score will not support. There's lots of JMSL that MusicXML will never support.
We are looking for maximal overlap, ie being able to import as much MusicXML that actually maps onto JMSL Score designs, and 
gracefully recover from unsupported features that the parser is bound to encounter.

Nick Didkovsky
nick@didkovsky.com
Feb 14, 2011, NYC



  