Introduction:
------------
This guide shows how to convert a MusicXML file into a webpage that displays
score and plays music while keeping the score synchronized with the music.
The score behaves as a progress bar for an audiofile.

The conversion is shown with an example file taken from a set distributed by MakeMusic,
which you can download from: http://downloads2.makemusic.com/musicxml/xmlsamples.zip
The file used is MozaChloSample.xml

The software:
-------------
MuseScore to produce an .ogg (.mp3) file of the score
xml2abc.py to convert xml to abc
abcm2ps to typeset abc to svg
svgParse.py to read the svg and produce the webpage

The Steps:
----------
(All actions in these steps are performed in one and the same directory, where the sample
file MozaChloSample.xml is saved. It is also assumed that xml2abc.py, svgParse.py are
present in this directory and that python and abcm2ps are on your path)

1--- We need to change the upbeat of the xml file. SvgParse does not understand upbeats, but
always assumes that a bar contains the full number of beats from the metre. So we modify
the upbeat to a full measure.
We use MuseScore in this guide to change the upbeat in the xml file and then to produce a
synthesized performance as an .ogg (or .mp3) file.
(Alternitavely, you could change the upbeat in the translated abc code and then use abc2midi,
a synthesizer and an encoder to produce the .ogg file. This seems more cumbersome, however)

- Open MozaChloSample.xml in MuseScore
- Right click on the upbeat measure (anacrusis) and select Measure Properties
- Change the actual measure duration from 1/4 to 4/4, so actual and nominal duration are
both 4/4. It is a normal complete measure now. Click Ok and the Measure Properties window
closes. The two notes in this upbeat measure are now at the wrong side.
- Select (shift-click) and Cut these two notes. You have now two rests. One of 1/4 and
one of 3/4. Click on the first one.
- Type 5, then three times 0 and press escape. This inserts 3 rests of 1/4 leaves the
measure filled with four rests of 1/4.
- Click on the last one and select Edit/Paste (ctl-V). And press escape again.
You have now moved the two notes of the upbeat to the end of a full measure.
Now remove all ugly green pagebreaks to allow MuseScore to do the formatting:
- Click on each green line- and pagebreak and press Delete.
- Save the file as MozaChloSample.xml (use Save-As, overwrite the original)
- Save-As the file again with the same name, but now select the file format .ogg! This will
produce a synthsized performance of the score. Of cource, you may first want to tune the
sound by changing parameters in the mixer panel. But do not change the tempo!!

2--- Convert MozaChloSample.xml to abc
    > python xml2abc.py -o. MozaChloSample.xml
    -- skipped empty voice 2
    -- skipped empty voice 3
    -- skipped empty voice 4
    MozaChloSample.abc written with 3 voices

3--- Add page formatting to the abc file and change the Q:
Insert some page formatting to make it suitable for the web. Always use a scale factor
smaller than 1.0. (beacause of an issue in svgParse that I have not yet resolved: when
you use 1.0 svgParse will raise an exception). So put the following formatting in front:
    %%pageheight 20cm
    %%pagewidth 30cm
    %%scale 0.99
    %%measurenb 5
    X:1
    T:An Chloe (Page 1)
    C:Wolfgang Amadeus Mozart
    ....
Next, SvgParse expects a numeric tempo indication, where the tempo is specified in the
unit of the metre. The metre is M:2/2 and we have to change the tempo to the same unit:
- Change Q:1/4=126 -> Q:1/2=63

4--- Typeset the score and produce an XHML file:
    > abcm2ps.exe -XO= MozaChloSample.abc
    abcm2ps-7.0.4 (March 31, 2012)
    File MozaChloSample.abc
    Output written on MozaChloSample.xhtml (3 pages, 1 title, 65400 bytes)

5--- Run svgParse and procuce the webpage:
    > python svgParse.py MozaChloSample.xhtml
    MozaChloSample_play.html written

6--- start the browser:
    > path\to\FireFox.exe MozaChloSample_play.html
    or just double click MozaChloSample_play.html

and press the play button ...
Only two files are actually used: MozaChloSample_play.html and MozaChloSample.ogg