Rhythm Selection & Cleanup
ci / checks (push) Successful in 1h16m10s

This commit is contained in:
khodowany
2026-09-26 02:50:22 -05:00
parent 4d6348d354
commit 9fd5abd075
91 changed files with 4692 additions and 2484 deletions
+8 -8
View File
@@ -1,17 +1,17 @@
from __future__ import annotations
from dataclasses import dataclass
from typing import Literal
import dataclasses
import typing
from generator.score import body_start_measure_index
import generator.score
@dataclass(frozen=True)
@dataclasses.dataclass(frozen=True)
class ArrangementSection:
label: str
source_measure_index: int
measure_count: int
section_index: int
role: Literal["rhythm", "accompaniment", "melody", "vocal", "rest", "slash"]
role: typing.Literal["accompaniment", "melody", "vocal", "rest", "slash"]
def phrase_aware_edge_measure_count(body_measure_count: int) -> int:
if body_measure_count >= 8:
@@ -20,9 +20,9 @@ def phrase_aware_edge_measure_count(body_measure_count: int) -> int:
return 4
return body_measure_count
def section_role(part_type: str, section_index: int) -> Literal["rhythm", "accompaniment", "melody", "vocal", "rest", "slash"]:
def section_role(part_type: str, section_index: int) -> typing.Literal["accompaniment", "melody", "vocal", "rest", "slash"]:
if part_type == "acoustic":
return "slash" if section_index == 3 else "rhythm"
return "slash" if section_index == 3 else "accompaniment"
if part_type == "electric":
if section_index == 4:
return "slash"
@@ -36,7 +36,7 @@ def section_role(part_type: str, section_index: int) -> Literal["rhythm", "accom
def full_arrangement_sections(measures: list[dict], part_type: str) -> list[ArrangementSection]:
if not measures:
return []
body_start = body_start_measure_index(measures)
body_start = generator.score.body_start_measure_index(measures)
if body_start >= len(measures):
return []
body_measure_count = len(measures) - body_start