Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML: Start supporting manual Beam #120

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

XML: Start supporting manual Beam #120

wants to merge 3 commits into from

Conversation

uliska
Copy link
Collaborator

@uliska uliska commented May 4, 2018

Export "first" beam.
This works only with regular eighth note beams. Anything else won't work.
Only beam nr 1 is created and ended.
But if more than one beam is involved they have to be encoded all.

That means
a) we have to check the number of beams at [ and ]
b) we have to check at each note if it is beamed, and if so
the current number of beams has to be calculated.
(seems challenging)

Export "first" beam.
This works only with regular eighth note beams. Anything else won't work.
Only beam nr 1 is created and ended.
But if more than one beam is involved they have to be encoded all.

That means
a) we have to check the number of beams at [ and ]
b) we have to check at each note if it is beamed, and if so
   the current number of beams has to be calculated.
(seems challenging)
@uliska
Copy link
Collaborator Author

uliska commented May 4, 2018

To get more specific:

{
  a'8 [ b'16 a' ]
}

will be exported to (excerpt)

    <measure number="1">
      <attributes>
        <divisions>8</divisions>
        <time symbol="common">
          <beats>4</beats>
          <beat-type>4</beat-type>
        </time>
        <clef>
          <sign>G</sign>
          <line>2</line>
        </clef>
      </attributes>
      <note>
        <pitch>
          <step>A</step>
          <octave>4</octave>
        </pitch>
        <duration>4</duration>
        <voice>1</voice>
        <type>eighth</type>
        <beam number="1">begin</beam>
      </note>
      <note>
        <pitch>
          <step>B</step>
          <octave>4</octave>
        </pitch>
        <duration>2</duration>
        <voice>1</voice>
        <type>16th</type>
      </note>
      <note>
        <pitch>
          <step>A</step>
          <octave>4</octave>
        </pitch>
        <duration>2</duration>
        <voice>1</voice>
        <type>16th</type>
        <beam number="1">end</beam>
      </note>
    </measure>

This correctly represents the beginning and end of the beam, and it would work if there is only one quaver beam. But MusicXML requires all intermediate states to be encoded in detail. The correct way to represent the music in XML is

      <note>
        <pitch>
          <step>A</step>
          <octave>4</octave>
        </pitch>
        <duration>4</duration>
        <voice>1</voice>
        <type>eighth</type>
        <beam number="1">begin</beam>
      </note>
      <note>
        <pitch>
          <step>B</step>
          <octave>4</octave>
        </pitch>
        <duration>2</duration>
        <voice>1</voice>
        <type>16th</type>
        <beam number="1">continue</beam>
        <beam number="2">begin</beam>
      </note>
      <note>
        <pitch>
          <step>A</step>
          <octave>4</octave>
        </pitch>
        <duration>2</duration>
        <voice>1</voice>
        <type>16th</type>
        <beam number="1">end</beam>
        <beam number="2">end</beam>
      </note>

In order to achieve this we'd have to keep track of

uliska added 2 commits May 5, 2018 09:11
As described in
http://lists.gnu.org/archive/html/lilypond-user/2018-05/msg00128.html
there is the possibility to simply encode *one* beam and add
<beam>continue</beam> to each enclosed note.

This is no correct MusicXML, but it will correctly be loaded by MuseScore
and Verovio (test at http://www.verovio.org/musicxml.html).

If we agree to stick with that halfway solution (at least for now) I think we
can now (after adding a test file) merge this.
@uliska
Copy link
Collaborator Author

uliska commented May 5, 2018

Tests for correctly handling the incorrect XML (encoding a single beam):

  • MuseScore 2
  • Verovio (converstion to MEI)
    (it seems MEI's representation is much closer to LilyPond than MusicxML: after Verovio converts the test file to MEI there's a single <beam> element enclosing the notes rather than attaching beam information to each note. The number of beam(let)s doesn't seem to be encoded in MEI, at least by default.)
  • Finale (2014.5)
  • Sibelius
  • Dorico
  • Mozart
  • SCORE

@uliska uliska changed the title XML: Start supporting manual Beam (WIP) XML: Start supporting manual Beam May 5, 2018
@uliska
Copy link
Collaborator Author

uliska commented May 5, 2018

OK, it seems all major programs properly handle the subpar code exported after this Pull Request. While it is definitely not satisfying not to have a proper translation of the beaming pattern to correct MusicXML representation I think this is definitely an improvement and should be merged (other coding issues notwithstanding ...)

@uliska uliska removed the help wanted label May 7, 2018
@uliska
Copy link
Collaborator Author

uliska commented Oct 13, 2018

@PeterBjuhr any chance to review these pull requests? I just stumbled over them again ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant