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

AssertionError when parsing musicXML #5

Open
johentsch opened this issue Jan 23, 2020 · 1 comment
Open

AssertionError when parsing musicXML #5

johentsch opened this issue Jan 23, 2020 · 1 comment

Comments

@johentsch
Copy link

johentsch commented Jan 23, 2020

I've tried to extract annotations from the attached musicXML minimal example which I have created and exported in MuseScore2 (changed file extension for upload: test2.txt ).

There were two trials where I got a "Badly formed annotation", namely when using spaces instead of ~ and when the last entry in a label ends with a comma. If I want to annotate a lot, I (personally) don't want to use ~ instead of spaces.

EDIT: I suggest this regex to be used with findall/extractall:
(?P<depth>\d+): ?(?P<label>.+?)(, |,|$)

When the annotations weren't badly formed any more, I got this with every single trial:

python ~/Taking-Form/markup/xml2brackets.py test2.musicxml test2.csv
Traceback (most recent call last):
  File "~/Taking-Form/markup/xml2brackets.py", line 24, in <module>
    main(parser, renderer, inputFile, outputFile)
  File "~/Taking-Form/markup/main.py", line 30, in main
    tree.build(parser.getAnnotations(), parser.getScoreEnd()[0])
  File "~/Taking-Form/markup/Tree.py", line 131, in build
    self.root.addChild(annotation)
  File "~/Taking-Form/markup/Tree.py", line 42, in addChild
    self.children = [Node(Annotation(str(self.getDepth()+1)+": INSERTED LABEL", self.getMeasure(), self.getBeat()))]
  File "~/Taking-Form/markup/Tree.py", line 99, in getBeat
    assert(False)
AssertionError
@MarkGotham
Copy link
Owner

Thanks for this. Two issues in one here:

  1. Regex
  2. Run fail

I completely agree about the regex and will look into the run fail. The latter is almost certainly due to the corpora formats advancing ahead of the code.

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

No branches or pull requests

2 participants