@@ -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
|
||||
|
||||
Reference in New Issue
Block a user