Skip to content

Commit

Permalink
minor corrections.
Browse files Browse the repository at this point in the history
  • Loading branch information
manoskary committed Dec 3, 2024
1 parent 1c88e59 commit 86117e8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
20 changes: 11 additions & 9 deletions partitura/io/exportmei.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import math
from collections import defaultdict
from lxml import etree
import lxml
import partitura.score as spt
from operator import itemgetter
from itertools import groupby
Expand Down Expand Up @@ -553,15 +554,16 @@ def _handle_fingering(self, measure_el: lxml.etree._Element, start: int, end: in
The position doesn't really matter since the startid attribute will place it correctly
"""
for note in self.part.iter_all(spt.Note, start=start, end=end):
for technical_notation in note.technical:
if isinstance(technical_notation, score.Fingering) and note.id is not None:
fing_el = etree.SubElement(measure_el, "fing")
fing_el.set(XMLNS_ID, "fing-" + self.elc_id())
fing_el.set("startid", note.id)
# Naive way to place the fingering notation
fing_el.set("place", ("above" if note.staff == 1 else "below"))
# text is a child element of fingering but not a xml element
fing_el.text = technical_notation.fingering
if note.technical is not None:
for technical_notation in note.technical:
if isinstance(technical_notation, score.Fingering) and note.id is not None:
fing_el = etree.SubElement(measure_el, "fing")
fing_el.set(XMLNS_ID, "fing-" + self.elc_id())
fing_el.set("startid", note.id)
# Naive way to place the fingering notation
fing_el.set("place", ("above" if note.staff == 1 else "below"))
# text is a child element of fingering but not a xml element
fing_el.text = technical_notation.fingering


@deprecated_alias(parts="score_data")
Expand Down
2 changes: 1 addition & 1 deletion partitura/score.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import numpy as np
import re
from scipy.interpolate import PPoly
from typing import Union, List, Optional, Iterator, Iterable as Itertype
from typing import Union, List, Optional, Iterator, Any, Iterable as Itertype
import difflib
from partitura.utils import (
ComparableMixin,
Expand Down

0 comments on commit 86117e8

Please sign in to comment.