instrumental introduction

This commit is contained in:
2025-10-21 13:34:16 +02:00
parent 3a5d449424
commit 837a634997
6 changed files with 226 additions and 92 deletions
+17 -4
View File
@@ -39,8 +39,10 @@ import { FONT_FAMILY } from "../../styles/Fonts";
import Style, { gutters, size } from "../../styles/Style";
import {
formatStructureLabel,
getPromptLabelForStructure,
getSegmentMeta,
normalizeStructureType,
segmentRequiresLyrics,
} from "../../utils/songStructure";
// 20 secondes
@@ -333,12 +335,20 @@ const MusicDetails = ({ route }) => {
const counts = {};
return project.lyrics
.map((s) => {
const body = (s?.lyrics || "").trim();
if (!body) return null;
const type = normalizeStructureType(s?.type);
const requiresLyrics = segmentRequiresLyrics(type);
const body = (s?.lyrics || "").trim();
if (requiresLyrics && !body) return null;
counts[type] = (counts[type] || 0) + 1;
const label = formatStructureLabel(type, counts[type]);
return `[${label}]\n${body}`;
const displayLabel =
typeof label === "string" && label.length > 0
? label
: getPromptLabelForStructure(type);
if (!requiresLyrics) {
return `[${displayLabel}] — section instrumentale`;
}
return `[${displayLabel}]\n${body}`;
})
.filter(Boolean)
.join("\n\n");
@@ -404,8 +414,11 @@ const MusicDetails = ({ route }) => {
const normalized = normalizeStructureType(type);
const meta = getSegmentMeta(normalized);
if (meta) {
return formatStructureLabel(normalized, index);
const label = formatStructureLabel(normalized, index);
if (label) return label;
}
const prompt = getPromptLabelForStructure(normalized);
if (prompt) return prompt;
if (normalized === "refrain")
return index > 1 ? `Refrain ${index}` : "Refrain";
if (normalized === "couplet")