Skip to content

Neon‐Verovio File Conversion

Yinan Zhou edited this page Aug 1, 2024 · 3 revisions

Neon uses Verovio for rendering and editing. For Verovio to work with Neon, we need to convert the MEI files input to Neon to a structure that Verovio uses. This requires 2 conversions:

  1. Neon MEI to Verovio score-based structure (in Neon ConvertMei.ts)
  2. Verovio score-based structure to Verovio page-based structure (inside Verovio)

Neon MEI to Verovio score-based structure

In Neon MEI, the mdiv element structure is:

/mdiv
  /score
    /section
      /staff
        /layer
          /pb
          /sb
          (staff content)
          /sb
          (staff content)
          ...

For verovio to render for Neon, we first need to set facsimile with @type="transcription". And then convert the file structure to:

/mdiv
  /score
    /section*
      /pb
      /sb
      /section@type="neon-neume-line" (i.e, measure)
        /staff
          /layer
            (staff content)
      /sb
      /section@type="neon-neume-line" (i.e, measure)
        /staff
          /layer
            (staff content)
          ...

In Neon, we need to manually set each section with @type="neon-neume-line". When Verovio loads the file, section@type="neon-neume-line" will be a Measure object in Verovio.

Verovio score-based structure to Verovio page-based structure

Where turning the MEI file into a page-based structure, some elements that are containers of other elements in the tree become milestones because the hierarchy is changing.

Verovio paged-based structure:

/pages
  /page
    /mdiv (page milestone start)
    /score (page milestone start)
    /system
      /section (system milestone start)
      /pb
      /sb
      /measure (i.e. section@type="neon-neume-line")
        /staff
          /layer
            (staff content)
    /system
      /sb
      /measure (i.e. section@type="neon-neume-line")
        /staff
          /layer
            (staff content)
    ...
    /system
      /sb
      /measure (i.e. section@type="neon-neume-line")
        /staff
          /layer
            (staff content)
      /system milestone end (pointing to /section)
    /page milestone end (pointing to /score)
    /page milestone end (pointing to /mdiv)

Therefore, in Verovio EditorToolkitNeume::SortStaves(), we need to make sure that:

  1. section is the first child of the first system
  2. pb is the second child of the first system
  3. system milestone end is the last child of the last system