XChords technical notes

ARCHITECTURE:

XChords 0.1 was monolithic code, which did everything in one step. Starting from XChords 0.2, I try to modularize the process. Look at the picture:

Core does the conversion from XML to SVG in two steps. The first step is preprocessing, which calculates some information, that is needed for easier drawing, the result of this step is intermediate XChordsDraw XML format. The second step creates SVG files (and HTML with SVG's). In future versions it will be possible to create your own draw stylesheets and use them in the process. I hope, there will be also few built-in basic drawing styles.

Core (not separated to two steps) was the whole 0.1.

0.2. comes with Output modules. It uses external applications (now fop and batik) to create PDF, PNG/TIFF/JPEG, HTML with pictures ... You have to download these applications, and setup the paths to them in scripts in /bin directory. I am using fop 0.20.4 and batik 1.1.1.

Aside from this graphical conversion, there still exists the possibility to produce textual representation of the chord (C: 032010). The conversion is straightforward and is done with another stylesheet directly from XChords XML format.

Techno notes from XChords 0.1: The whole thing is written in XSLT 1.0, with xalan extension for multiple output documents.
That's the only extension. I did really much of work to avoid max() function.

FEATURES:

FRETS COUNTING

If You need deeper understanding of how the frets are transformed, here it is.

XChords and XChords Draw has different meaning of fret numbers.
XChords fret numbers are absolute at guitar neck in real. (that means - just write down, which fingers holds which frets)
XChords Draw fret numbers are absolute at guitar neck picture (plot, matrix,...).


Look at example:

XChords code snippet: Resulting picture: Intermediate XChords Draw code snippet:
<position base="1">
    <string name="a" fret="3" finger="3"/>
</position>
<position fretlabel="1" base="1" maxfret="3">
    <endneck fret="4"/>
    <string finger="3" name="a" fret="3"/>
</position>
<position base="2">
    <string name="a" fret="3" finger="3"/>
</position>
<position fretlabel="2" base="1" maxfret="2">
<endneck fret="3"/>
<string finger="3" name="a" fret="2"/>
</position>
<position base="1">
<string name="a" fret="6" finger="2"/>
<string name="b" fret="7" finger="3"/>
</position>
<position fretlabel="1" base="1" maxfret="7">
<endneck fret="8"/>
<string finger="3" name="b" fret="7"/>
<string finger="2" name="a" fret="6"/>
</position>
<position base="5">
    <string name="a" fret="6" finger="2"/>
    <string name="b" fret="7" finger="3"/>
</position>
<position fretlabel="5" base="1" maxfret="3">
    <endneck fret="4"/>
    <string finger="3" name="b" fret="3"/>
    <string finger="2" name="a" fret="2"/>
</position>

Explanation:

XChordsDraw - (picture space) it's really just absolute information about where on the neck plot draw what. The neck first fret has number 1, second fret is 2, and so on.

position:
-the number from 'fretlabel' is written at 'base' fret at left side.
-'maxfret' is used in recounting - what's the highest fret number with some circle or barre in this position. (endneck and separator elements are created then from this information)

string:
-the circle is draw at fret 'fret'
-with label from 'finger' attribute
-at string from 'name' attribute

endneck:
-draw endneck at specified fret

XChords (real world space)

position:
-base would be the first draw fret at guitar (or in position, if not the first). This is usefull, if the position is at high numbers.

string:
-fret number in absolute meaning in the real world