Music XML
ci / checks (push) Successful in 42m24s

This commit is contained in:
khodowany
2026-09-10 22:01:18 -05:00
parent ea4e0bbba1
commit f84717990b
47 changed files with 16739 additions and 8391 deletions
+7 -7
View File
@@ -6,6 +6,7 @@ from typing import Any
from generator.score import load_json, measure_notes
from generator.transposition import TARGET_KEYS
from generator.model import fraction, pitch_name
def _arranged_staff(document: dict[str, Any]) -> dict[str, Any]:
@@ -20,17 +21,16 @@ def _measure_summary(staff: dict[str, Any], measure: dict[str, Any], measure_num
summary: dict[str, Any] = {
"measure": measure_number,
"section_label": str(measure.get("section_label", "")),
"chord_symbols": [str(note.get("chord_symbol", "")) for note in notes if isinstance(note.get("chord_symbol"), str) and note.get("chord_symbol")],
"harmonies": [{"onset": str(fraction(h["onset"])), "symbol": h["symbol"]} for h in measure["harmonies"]],
"duration": str(fraction(measure["duration"])),
"slash_count": sum(1 for note in notes if note.get("kind", "note") == "note" and note.get("notehead") == "slash"),
}
if staff.get("arrangement_part_type") == "vocal":
summary["vocal_skeleton"] = [
{
"kind": str(note.get("kind", "note")),
"duration_ticks": int(note.get("duration_ticks", 0)),
"display_ticks": int(note["display_ticks"]) if isinstance(note.get("display_ticks"), int) else None,
"has_lyric": isinstance(note.get("lyric"), str) and bool(note.get("lyric")),
}
f'{fraction(note["onset"])}+{fraction(note["duration"])} '
+ note['written']['type'] + '.'*note['written'].get('dots',0)
+ ' ' + note['kind'] + ' ' + ','.join(pitch_name(p)+str(p['octave']) for p in note['pitches'])
+ ' ' + note.get('lyric','')
for note in notes
]
return summary