Skip to content

Commit

Permalink
Beam support, move screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
infojunkie committed Dec 6, 2024
1 parent 2a0b357 commit 575e68a
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 7 deletions.
Binary file removed 01f-Pitches-ParenthesizedMicrotoneAccidentals.png
Binary file not shown.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ MusicXML to MuseScore converter and back.
- `npm run --silent convert:mscx /path/to/score.musicxml instrumentsFile=/path/to/MuseScore/share/instruments/instruments.xml styleFile=/path/to/MuseScore/stylesheet.mss`

# Examples
Screenshot of a score converted with a specialized stylesheet file.
Screenshot of an official MusicXML example converted to MuseScore format. There are subtle differences from what MuseScore itself would import from MusicXML.

![Screenshot of an official MusicXML example converted to MuseScore format.](https://github.com/infojunkie/musicxml-mscx/blob/main/doc/screenshots/tutorial-percussion.png?raw=true)

![Screenshot of a score converted with a specialized stylesheet file.](https://github.com/infojunkie/musicxml-mscx/blob/main/9-20-special.png?raw=true)
Screenshot of a Lilypond test snippet with microtonal accidentals. Not shown are the note tunings that are converted correctly and that MuseScore would miss when it imports the MusicXML.

Screenshot of a Lilypond test snippet with microtonal accidentals.
![Screenshot of a Lilypond test snippet with microtonal accidentals.](https://github.com/infojunkie/musicxml-mscx/blob/main/doc/screenshots/01f-Pitches-ParenthesizedMicrotoneAccidentals.png?raw=true)

Screenshot of a score converted with a specialized stylesheet file.

![Screenshot of a Lilypond test snippet with microtonal accidentals.](https://github.com/infojunkie/musicxml-mscx/blob/main/01f-Pitches-ParenthesizedMicrotoneAccidentals.png?raw=true)
![Screenshot of a score converted with a specialized stylesheet file.](https://github.com/infojunkie/musicxml-mscx/blob/main/doc/screenshots/9-20-special.png?raw=true)

# Theory of operation
Why write a new converter between MusicXML and MuseScore, when MuseScore itself already does 2-way conversion?
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added doc/screenshots/tutorial-percussion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 25 additions & 3 deletions src/mscx.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -645,9 +645,9 @@
<xsl:otherwise>
<Chord>
<xsl:apply-templates select="notations/slur"/>
<xsl:if test="stem">
<StemDirection><xsl:value-of select="stem"/></StemDirection>
</xsl:if>
<xsl:apply-templates select="stem"/>
<xsl:apply-templates select="beam"/>
<xsl:apply-templates select="preceding-sibling::note[not(chord) and current()/chord]/beam"/>
<xsl:apply-templates select="current()" mode="inner">
<xsl:with-param name="overrideChord" select="true()"/>
</xsl:apply-templates>
Expand Down Expand Up @@ -705,6 +705,28 @@
]" mode="inner"/>
</xsl:template>

<!--
Template: Note > Stem.
-->
<xsl:template match="stem">
<StemDirection><xsl:value-of select="text()"/></StemDirection>
</xsl:template>

<!--
Template: Note > Beam.
-->
<xsl:template match="beam">
<xsl:if test="not(@number) or @number = '1'">
<BeamMode>
<xsl:choose>
<xsl:when test="text() = 'begin'">begin</xsl:when>
<xsl:when test="text() = 'continue'">mid</xsl:when>
<xsl:when test="text() = 'end'">end</xsl:when>
</xsl:choose>
</BeamMode>
</xsl:if>
</xsl:template>

<!--
Template: Rest > Offset.
-->
Expand Down

0 comments on commit 575e68a

Please sign in to comment.