Skip to content

Support Staff-Tuning tags in musicxml with sensible default #778

@louisbigo

Description

@louisbigo

music21 version

6.5.0

Problem summary
Hi,

It seems that the musicXML writer can produce mistakes when the m21 stream corresponds to a tablature.

The parsing seems ok (string/fret informations seem correctly stored in the m21 stream in articulations.FretIndication / articulations.StringIndication). However, the written musicXML file is invalid (as indicated when opening with MuseScore for example).

When looking into it, it seems that unexpected fret tags (more precisely <fret>0</fret>) have been added in place of technical indications (like hammer-on, pull-off) - see example below. I would not be suprised that multiple (and distinct) fret indications for one single note induces this invalidity.

I guess that guitar specific technics such as hammer-on/pull-off are not yet implemented in m21. I think that simply omitting them (instead of replacing them by non-sense <fret>0</fret>) would produce a valid musicXML and might be a good option until that time.

Thanks again for this fantastic tool !

Steps to reproduce

The musicXML page dedicated to tab (https://www.musicxml.com/tutorial/tablature/fret-and-string/) provides a simple test file (tab1.musicxml).

from music21 import *
tabmxml = converter.parse('./tab1.musicxml')
tabmxml.write('musicxml','./tab1-m21.musicxml')

In tab1.musicxml we have (l.321) :

<technical>
  <pull-off number="1" type="stop"/>
  <pull-off number="1" type="start">P</pull-off>
  <string>3</string>
  <fret>7</fret>
</technical>

and in the analogue place of the file written by m21 (tab1-m21.musicxml) we have (l.288) :

<technical>
  <fret>0</fret>
  <fret>0</fret>
  <string>3</string>
  <fret>7</fret>
</technical>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions