def visit_Tandem(self, obj): if obj.type == "clef": data = CLEFS[obj.data]['lily'] elif obj.type == "key-signature": data = "{0} \\major".format(music.notename_to_lily(music.key_name(obj.data))) elif obj.type in ["key"]: data = None else: data = obj.data obj_type = TANDEM_TABLE.get(obj.type) obj_type_lily = obj_type['lily'] if obj_type else "" if obj_type_lily and data is not None: return "{0} {1}\n".format(obj_type_lily if obj_type_lily else "", data) else: return ""
def visit_Note(self, obj): name = music.notename_to_lily(obj.name, obj.octave) dur = music.frac_to_dur(obj.duration) return "{0}{1}".format(name, dur)
def visit_Note(self, obj): name = music.notename_to_lily(obj.name, obj.octave) dur = music.frac_to_dur(obj.duration) articulations = [NOTE_TABLE[a]['lily'] for a in obj.articulations] return "{0}{1}{2}".format(name, dur, "".join(articulations))
def test_notename_to_lily_d2s0(): assert music.notename_to_lily("D##", 0) == "disis,,,"
def test_notename_to_lily_d2s7(): assert music.notename_to_lily("D##", 7) == "disis''''"
def test_notename_to_lily_c2f5(): assert music.notename_to_lily("Cbb", 5) == "ceses''"
def test_notename_to_lily_c2f4(): assert music.notename_to_lily("Cbb", 4) == "ceses'"
def test_notename_to_lily_c2f3(): assert music.notename_to_lily("Cbb", 3) == "ceses"
def test_notename_to_lily_c2f2(): assert music.notename_to_lily("Cbb", 2) == "ceses,"
def test_notename_to_lily_c2f1(): assert music.notename_to_lily("Cbb", 1) == "ceses,,"