As a work around I found the following solution:
from scamp import Session
from scamp.spanners import Spanner
from xml.etree import ElementTree
from pymusicxml.score_components import StopNumberedSpanner, StartNumberedSpanner
from pymusicxml.notations import Notation
class pymusicxmlStopTie(Notation, StopNumberedSpanner):
def render(self):
return ElementTree.Element("tied", {"type": "stop", "number": str(self.label)}),
class pymusicxmlStartTie(Notation, StartNumberedSpanner):
STOP_TYPE = pymusicxmlStopTie
def render(self):
return ElementTree.Element("tied", {"type": "start", "number": str(self.label)}),
class StartTie(Spanner):
START_MID_OR_STOP = "start"
FORMATTING_SLOTS = {}
def to_pymusicxml(self):
return pymusicxmlStartTie(label=self.label, **self._get_xml_consistent_formatting())
def to_abjad(self):
return None
class StopTie(Spanner):
START_MID_OR_STOP = "stop"
FORMATTING_SLOTS = {}
def to_pymusicxml(self):
return pymusicxmlStopTie(label=self.label, **self._get_xml_consistent_formatting())
def to_abjad(self):
return None
s = Session()
violin = s.new_part("Violin")
s.fast_forward_to_beat(1000)
s.start_transcribing()
violin.play_note(60, 1, 4, ["pp", "start hairpin", StartTie()])
violin.play_note(60, 1, 2, [StopTie(), StartTie()])
violin.play_note(60, 1, 2, ["ff", "stop hairpin", "start hairpin >", "start hairpin", StopTie(), StartTie()])
violin.play_note(60, 1, 4)
violin.play_note(62, 0, 2, ["pp", "stop hairpin"])
s.stop_transcribing().to_score(time_signature="4/4").export_music_xml("tied-notes-test.xml")
After importing the created xml file into Sibelius I got what I want:
This solution isn’t ideal because I have to do the quantization by myself. That is, I can not write
violin.play_note(60, 1, 6, ["pp", "start hairpin", StartTie()])
because the quantization process splits the 6/4 note into two notes. Unfortunately, the second note doesn’t get the StartTie() property.