new song structure

This commit is contained in:
2025-10-22 16:04:12 +02:00
parent 7b68a8c101
commit da001a491b
6 changed files with 420 additions and 86 deletions
+186
View File
@@ -65,6 +65,10 @@ export const STRUCTURE_SEGMENTS = {
"intro instrumentale longue",
],
},
// pre_chorus: {
// label: "Pré-refrain",
// promptLabel: "Pré-refrain",
// showIndex: false,
pre_chorus: {
label: "Pré-refrain",
promptLabel: "Pré-refrain",
@@ -81,6 +85,151 @@ export const STRUCTURE_SEGMENTS = {
"pré chorus",
],
},
pre_refrain_instrumental: {
label: "Pré-refrain instrumental",
promptLabel: "Pré-refrain instrumental",
showIndex: false,
allowMultiple: false,
optional: true,
inputHeight: 150,
exclusiveGroup: "pre_chorus",
requiresLyrics: false,
aliases: ["instrumental_pre_chorus"],
},
pont: {
label: "Pont",
promptLabel: "Pont",
showIndex: false,
allowMultiple: true,
optional: true,
inputHeight: 225,
requiresLyrics: true,
aliases: ["bridge"],
},
solo_de_guitare: {
label: "Solo de guitare",
promptLabel: "Solo de guitare",
showIndex: true,
allowMultiple: true,
optional: true,
inputHeight: 150,
requiresLyrics: false,
aliases: ["guitar_solo", "solo_guitare"],
},
solo_de_guitare_electrique: {
label: "Solo de guitare électrique",
promptLabel: "Solo de guitare électrique",
showIndex: true,
allowMultiple: true,
optional: true,
inputHeight: 150,
requiresLyrics: false,
aliases: ["electric_guitar_solo", "solo_guitare_electrique"],
},
solo_de_batterie: {
label: "Solo de batterie",
promptLabel: "Solo de batterie",
showIndex: true,
allowMultiple: true,
optional: true,
inputHeight: 150,
requiresLyrics: false,
aliases: ["drum_solo", "solo_batterie"],
},
solo_de_saxophone: {
label: "Solo de saxophone",
promptLabel: "Solo de saxophone",
showIndex: true,
allowMultiple: true,
optional: true,
inputHeight: 150,
requiresLyrics: false,
aliases: ["sax_solo", "solo_saxo"],
},
solo_de_violon: {
label: "Solo de violon",
promptLabel: "Solo de violon",
showIndex: true,
allowMultiple: true,
optional: true,
inputHeight: 150,
requiresLyrics: false,
aliases: ["violin_solo", "solo_violon"],
},
break: {
label: "Break",
promptLabel: "Break",
showIndex: true,
allowMultiple: true,
optional: true,
inputHeight: 150,
requiresLyrics: false,
aliases: [],
},
interlude: {
label: "Interlude",
promptLabel: "Interlude",
showIndex: true,
allowMultiple: true,
optional: true,
inputHeight: 150,
requiresLyrics: false,
aliases: [],
},
interlude_melodique: {
label: "Interlude mélodique",
promptLabel: "Interlude mélodique",
showIndex: true,
allowMultiple: true,
optional: true,
inputHeight: 150,
requiresLyrics: false,
aliases: ["melodic_interlude"],
},
final_apogee: {
label: "Final apogée",
promptLabel: "Final apogée",
showIndex: false,
allowMultiple: false,
optional: true,
inputHeight: 170,
exclusiveGroup: "outro",
requiresLyrics: false,
aliases: ["grand_finale"],
},
arret_net: {
label: "Arrêt net",
promptLabel: "Arrêt net",
showIndex: false,
allowMultiple: false,
optional: true,
inputHeight: 150,
exclusiveGroup: "outro",
requiresLyrics: false,
aliases: ["sudden_stop"],
},
fade_out: {
label: "Fade out",
promptLabel: "Fade out",
showIndex: false,
allowMultiple: false,
optional: true,
inputHeight: 150,
exclusiveGroup: "outro",
requiresLyrics: false,
aliases: [],
},
transition_douce: {
label: "Transition douce vers le silence",
promptLabel: "Transition douce",
showIndex: false,
allowMultiple: false,
optional: true,
inputHeight: 150,
exclusiveGroup: "outro",
requiresLyrics: false,
aliases: ["soft_transition"],
},
};
const ALIAS_TO_KEY = Object.entries(STRUCTURE_SEGMENTS).reduce(
@@ -133,6 +282,7 @@ export const sanitizeStructureList = (structure = []) => {
if (!Array.isArray(structure)) return [];
const output = [];
let shouldInjectPreChorus = false;
let shouldInjectInstrumentalPreChorus = false;
structure.forEach((segment) => {
const type = normalizeStructureType(segment);
@@ -160,6 +310,10 @@ export const sanitizeStructureList = (structure = []) => {
shouldInjectPreChorus = true;
return;
}
if (type === "pre_refrain_instrumental") {
shouldInjectInstrumentalPreChorus = true;
return;
}
output.push(type);
});
@@ -188,6 +342,38 @@ export const sanitizeStructureList = (structure = []) => {
result = expanded;
}
if (shouldInjectInstrumentalPreChorus) {
const baseWithoutInstrumental = result.filter(
(item) => item !== "pre_refrain_instrumental"
);
const expanded = [];
baseWithoutInstrumental.forEach((item) => {
if (item === "pre_chorus") {
const previous = expanded[expanded.length - 1];
if (previous !== "pre_refrain_instrumental") {
expanded.push("pre_refrain_instrumental");
}
}
if (item === "refrain") {
const previous = expanded[expanded.length - 1];
if (
previous !== "pre_refrain_instrumental" &&
previous !== "pre_chorus"
) {
expanded.push("pre_refrain_instrumental");
}
}
expanded.push(item);
});
if (!expanded.includes("pre_refrain_instrumental")) {
expanded.push("pre_refrain_instrumental");
}
result = expanded;
}
const introIndex = result.findIndex(
(item) => item === "short_intro" || item === "long_intro"
);