pub fn plan(
analysis: &Analysis,
segment: &SegmentConfig,
config: &PlanConfig,
) -> PlanExpand description
Chooses cuts over the whole audio that keep every piece within max, minimizing the total
cost of all cuts and piece lengths (see Weights).
Candidates are the silence spans and the quietest point of every block of
min(1 s, max((max − min) / 2, max / 8)) outside them. Additional frame boundaries are inserted
when needed to satisfy the maximum or the piece count, including within padding. Padding that
would leave less than two blocks of the maximum is shortened to fit. Silence wins over quiet
sound through the cut cost. Cuts fall on analysis frame boundaries. The result is deterministic.
With PlanConfig::count, feasibility includes the removable silence ranges. Only when no
frame-grid plan can meet both limits is the maximum relaxed to the smallest attainable longest
piece; pieces exceeding the requested maximum are flagged Piece::too_long.