fabricatio_yue.models.segment

Models for representing song segments and complete songs.

This module provides the data structures for working with songs and their component segments in the Fabricatio YUE system. Songs are composed of multiple segments, each with their own properties like duration, genre tags, and lyrics.

Classes

Segment

Represents a segment of a song with its attributes.

Song

Represents a complete song with its attributes and segments.

Module Contents

class fabricatio_yue.models.segment.Segment(/, **data: Any)

Bases: fabricatio_core.models.generic.SketchedAble

Represents a segment of a song with its attributes.

section_type: str

Type of section.

duration: pydantic.NonNegativeInt

Duration of the segment in seconds

lyrics: List[str]

Lyrics for this segment as a list of lines

extra_genres: List[str] = None

Additional genre tags for this segment to control generation if specified.

override_extra_genres(genres: List[str]) Self

Override the genre tags for this segment.

Parameters:

genres (List[str]) – New list of genre tags

property assemble: str

Assemble the segment into a formatted string representation.

Returns:

A formatted string with section type header and lyrics

Return type:

str

class fabricatio_yue.models.segment.Song(/, **data: Any)

Bases: fabricatio_core.models.generic.SketchedAble, fabricatio_core.models.generic.WithBriefing

Represents a complete song with its attributes and segments.

genres: List[str]

Primary genre classifications for the entire song

segments: List[Segment]

Ordered list of segments that compose the song

property duration: pydantic.NonNegativeInt

Total duration of the song in seconds.

Calculated by summing the durations of all segments in the song.

Returns:

The total duration in seconds

Return type:

NonNegativeInt

override_genres(genres: List[str]) Self

Override the primary genre tags for the entire song.

Parameters:

genres (List[str]) – New list of genre tags

save_to(parent_dir: str | pathlib.Path) Self

Save the song to a directory.

Parameters:

parent_dir (str) – The directory to save the song to