feat(video): exemple 2 avec voix off provisoire (dots.tts-soar) et sous-titres mot a mot

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cette révision appartient à :
Théo GastineletClaude Opus 5.5 a révisé 2026-10-17 12:27:39 +02:00
1 Parent 12f3b0de6b
révision 0db8816d6a
11 fichiers modifiés
+632

Aucun fichier ne correspond à votre recherche

+248
Voir le fichier
@@ -0,0 +1,248 @@
import React from 'react';
import {AbsoluteFill, Audio, Easing, Sequence, interpolate, staticFile, useCurrentFrame} from 'remotion';
import {loadFont} from '@remotion/google-fonts/Inter';
import {C, Icon, IconBlock, Rule, Words, clamp, useSpr} from './NouveauteMind';
import {PHRASES} from './voixExemple2';
const {fontFamily} = loadFont('normal', {weights: ['400', '500', '600', '700', '800'], subsets: ['latin']});
// Vidéo exemple 2, AVEC voix off (voix provisoire : dots.tts-soar, voix par défaut, en attendant le clonage de Théo).
// Faits vérifiés le 17/10/2026 dans le code de Mind (prod, cornafserver) : voir NOTES/rapport-video-exemple2-20261017.md.
export const FPS_EV2 = 30;
const f = (sec: number) => Math.round(sec * FPS_EV2);
const LEAD = 0.3; // silence avant la 1re phrase
const GAP = 0.35; // silence entre phrases
const TAIL = 1.0; // fin
// ---------- Plans ----------
const Big: React.FC<{children: React.ReactNode; gap?: number}> = ({children, gap = 44}) => (
<div style={{display: 'flex', flexDirection: 'column', gap}}>{children}</div>
);
const Counter: React.FC<{to: number; dur: number; color: string; unit?: string; delay?: number}> = ({to, dur, color, unit = 's', delay = 2}) => {
const fr = useCurrentFrame();
const v = interpolate(fr, [delay, delay + dur], [0, to], {...clamp, easing: Easing.out(Easing.cubic)});
return (
<div style={{fontSize: 330, fontWeight: 800, letterSpacing: -16, lineHeight: 0.9, color}}>
{v.toFixed(1).replace('.', ',')}<span style={{fontSize: 150, letterSpacing: -4, marginLeft: 20}}>{unit}</span>
</div>
);
};
const Bar: React.FC<{label: string; val: number; max: number; color: string; delay: number}> = ({label, val, max, color, delay}) => {
const p = useSpr(delay, 22);
return (
<div style={{display: 'flex', flexDirection: 'column', gap: 14}}>
<div style={{display: 'flex', justifyContent: 'space-between', fontSize: 48, fontWeight: 700}}>
<span>{label}</span>
<span style={{color}}>{(val * p).toFixed(1).replace('.', ',')} s</span>
</div>
<div style={{height: 70, border: `3px solid ${C.ink}`, background: C.bg}}>
<div style={{height: '100%', width: `${(val / max) * 100 * p}%`, background: color}} />
</div>
</div>
);
};
/** Démonstration : le cadre se déroule (1,2 s) pendant que la réponse est déjà affichée. Réponse réelle de Mind (17/10). */
const Deroule: React.FC = () => {
const fr = useCurrentFrame();
const open = interpolate(fr, [4, 4 + f(1.2)], [0, 1], {...clamp, easing: Easing.inOut(Easing.cubic)});
const words = "L'altitude du Mont Aiguille est de 2 087 mètres.".split(' ');
const n = Math.floor(interpolate(fr, [8, 34], [0, words.length], clamp));
const t = Math.min(1.2, Math.max(0, (fr - 4) / FPS_EV2));
return (
<Big gap={36}>
<div style={{display: 'flex', alignItems: 'center', gap: 16}}>
<div style={{background: C.jaune, fontWeight: 800, fontSize: 28, letterSpacing: 5, padding: '8px 16px', border: `3px solid ${C.ink}`}}>RÉPONSE RÉELLE</div>
<span style={{fontSize: 26, fontWeight: 600, color: C.soft}}>interface reconstituée</span>
</div>
<div style={{position: 'relative', height: 520}}>
<div style={{position: 'absolute', inset: 0, transform: 'translate(14px,14px)', background: C.vert, maxHeight: 520 * open}} />
<div style={{position: 'absolute', inset: 0, background: '#f4f4f4', border: `3px solid ${C.ink}`, maxHeight: Math.max(6, 520 * open)}} />
<div style={{position: 'absolute', inset: 0, padding: 36, fontSize: 40, lineHeight: 1.45}}>
<div style={{borderLeft: `4px solid ${C.ink}`, paddingLeft: 20, marginBottom: 26}}>
<div style={{fontSize: 24, fontWeight: 700, letterSpacing: 3}}>VOUS</div>
Quelle est la hauteur du Mont Aiguille ?
</div>
<div style={{borderLeft: `4px solid #8c8c8c`, paddingLeft: 20}}>
<div style={{fontSize: 24, fontWeight: 700, letterSpacing: 3, color: C.soft}}>MIND</div>
{words.slice(0, n).join(' ')}
</div>
</div>
</div>
<div style={{display: 'flex', alignItems: 'center', gap: 20, fontSize: 40, fontWeight: 700}}>
<Icon name="horloge" size={56} color={C.vert} stroke={2.4} />
<span>cadre : {t.toFixed(1).replace('.', ',')} s</span>
<span style={{color: C.vert}}>· le texte est déjà là</span>
</div>
</Big>
);
};
const Format: React.FC<{part: 0 | 1}> = ({part}) => {
const p = useSpr(6, 20);
return (
<Big gap={40}>
<span style={{fontSize: 30, fontWeight: 700, letterSpacing: 5, color: C.soft}}>FORMAT DONNÉ À MIND</span>
{part === 0 ? (
<Words text="samedi 17 octobre 2026" size={120} hl={[1, 2]} accent={C.bleu} />
) : (
<>
<Words text="10 h 17" size={230} hl={[]} />
<div style={{background: C.jaune, border: `3px solid ${C.ink}`, padding: '14px 26px', fontSize: 64, fontWeight: 800, width: 'fit-content', transformOrigin: 'left', transform: `scaleX(${p})`}}>(heure de Paris)</div>
<span style={{fontSize: 30, fontWeight: 600, color: C.soft}}>heure d'exemple</span>
</>
)}
</Big>
);
};
const Stamp: React.FC = () => {
const p = useSpr(4, 12);
return (
<div style={{fontSize: 108, fontWeight: 800, letterSpacing: 4, border: `8px solid ${C.orange}`, color: C.orange, padding: '20px 34px', width: 'fit-content', transform: `scale(${2 - p}) rotate(-4deg)`, opacity: Math.min(1, p * 1.5)}}>
EN PRÉPARATION
</div>
);
};
type Sub = {at: number; chap: string; accent: string; node: React.ReactNode};
// `at` = début du plan, en secondes dans la phrase (calé sur un début de mot).
const SCENES: Sub[][] = [
[
{at: 0, chap: 'NOUVEAUTÉ · MIND', accent: C.jaune, node: <Big><IconBlock name="eclair" accent={C.bleu} size={230} /><Words text="Sur Mind," size={150} delay={6} hl={[1]} accent={C.bleu} /></Big>},
{at: 0.84, chap: 'NOUVEAUTÉ · MIND', accent: C.bleu, node: <Big><Words text="la réponse s’affiche" size={120} weight={700} /><Words text="tout de suite." size={170} delay={20} hl={[0, 1, 2]} accent={C.bleu} /></Big>},
],
[
{at: 0, chap: 'AVANT', accent: C.orange, node: <Big><Words text="Avant," size={220} hl={[0]} accent={C.orange} /><Rule delay={8} /></Big>},
{at: 1.08, chap: 'AVANT', accent: C.orange, node: <Big><IconBlock name="chat" accent={C.orange} size={220} fill={false} /><Words text="au premier message," size={130} delay={4} hl={[1]} accent={C.orange} /></Big>},
{at: 2.66, chap: 'AVANT', accent: C.orange, node: <Big><Words text="Mind attendait la fin d’une animation." size={110} hl={[5]} accent={C.orange} /><Bar label="animation du cadre" val={1.2} max={1.2} color={C.orange} delay={10} /></Big>},
{at: 4.36, chap: 'AVANT', accent: C.orange, node: <Big><Counter to={1.2} dur={30} color={C.orange} /><Words text="d’attente en plus." size={90} weight={700} color={C.soft} delay={8} /></Big>},
],
[
{at: 0, chap: 'AVANT', accent: C.orange, node: <Big><Words text="Une réponse courte était souvent prête…" size={120} hl={[2]} accent={C.orange} /></Big>},
{at: 2.02, chap: 'AVANT', accent: C.orange, node: <Big gap={60}><Bar label="réponse courte" val={0.5} max={1.2} color={C.ink} delay={2} /><Bar label="animation" val={1.2} max={1.2} color={C.orange} delay={10} /><span style={{fontSize: 30, fontWeight: 600, color: C.soft}}>ordre de grandeur relevé dans le code de Mind</span></Big>},
],
[
{at: 0, chap: 'MAINTENANT', accent: C.vert, node: <Big><IconBlock name="check" accent={C.vert} size={230} /><Words text="Désormais," size={170} delay={4} hl={[0]} accent={C.vert} /></Big>},
{at: 1.38, chap: 'MAINTENANT', accent: C.vert, node: <Deroule />},
],
[
{at: 0, chap: 'AUTRE DÉTAIL', accent: C.bleu, node: <Big><IconBlock name="horloge" accent={C.bleu} size={230} /><Words text="Autre détail :" size={140} delay={4} weight={700} /></Big>},
{at: 1.4, chap: 'AUTRE DÉTAIL', accent: C.bleu, node: <Format part={0} />},
{at: 2.66, chap: 'AUTRE DÉTAIL', accent: C.jaune, node: <Format part={1} />},
],
[
{at: 0, chap: 'BIENTÔT', accent: C.orange, node: <Big><IconBlock name="meteo" accent={C.orange} size={230} /><Words text="Un outil météo" size={150} delay={4} hl={[2]} accent={C.orange} /></Big>},
{at: 1.3, chap: 'BIENTÔT', accent: C.orange, node: <Big><div style={{display: 'flex', gap: 30}}>{['vent', 'pluie', 'soleil'].map((n, i) => <IconBlock key={n} name={n} accent={C.orange} size={170} delay={2 + i * 4} fill={i === 0} />)}</div><Words text="sur de vraies stations." size={120} delay={6} hl={[2, 3]} accent={C.orange} /><Words text="Des mesures, pas des prévisions." size={64} delay={20} weight={600} color={C.soft} /></Big>},
{at: 2.78, chap: 'BIENTÔT', accent: C.orange, node: <Big><Stamp /><Words text="réservé aux tests internes pour l’instant." size={64} delay={14} weight={600} color={C.soft} /></Big>},
],
[
{at: 0, chap: 'À TOI', accent: C.bleu, node: <Big><Words text="Essaie-le" size={200} hl={[0]} accent={C.bleu} /></Big>},
{at: 0.84, chap: 'À TOI', accent: C.bleu, node: <Cta />},
],
];
function Cta() {
const p = useSpr(4);
return (
<Big gap={50}>
<Words text="sur" size={130} weight={700} />
<div style={{background: C.ink, color: '#fff', padding: '26px 34px', fontSize: 92, fontWeight: 800, letterSpacing: -2, transformOrigin: 'left', transform: `scaleX(${p})`, whiteSpace: 'nowrap', width: 'fit-content'}}>mind.gastinel.me</div>
<div style={{display: 'flex', alignItems: 'center', gap: 24}}>
<Icon name="fleche" size={80} color={C.bleu} stroke={2.4} />
<Words text="Gastinel Mind" size={70} delay={16} weight={600} color={C.soft} />
</div>
</Big>
);
}
// ---------- Chronologie ----------
type Plan = {from: number; dur: number; sub: Sub};
type Bloc = {audioFrom: number; plans: Plan[]};
const blocs: Bloc[] = [];
let cursor = 0;
PHRASES.forEach((ph, i) => {
const lead = i === 0 ? LEAD : 0;
const end = i === PHRASES.length - 1 ? TAIL : GAP;
const start = cursor;
const audioFrom = start + f(lead);
const blocEnd = start + f(lead + ph.dur + end);
const subs = SCENES[i];
const plans = subs.map((s, j) => {
const from = j === 0 ? start : audioFrom + f(s.at);
const to = j === subs.length - 1 ? blocEnd : audioFrom + f(subs[j + 1].at);
return {from, dur: to - from, sub: s};
});
blocs.push({audioFrom, plans});
cursor = blocEnd;
});
export const TOTAL_EV2 = cursor;
// ---------- Plan et sous-titres ----------
const Shot: React.FC<{dur: number; accent: string; chap: string; children: React.ReactNode}> = ({dur, accent, chap, children}) => {
const fr = useCurrentFrame();
const wipe = interpolate(fr, [0, 9], [0, 1], {extrapolateRight: 'clamp', easing: Easing.bezier(0.7, 0, 0.2, 1)});
const zoom = interpolate(fr, [0, dur], [1, 1.03]);
return (
<AbsoluteFill style={{background: C.bg}}>
<AbsoluteFill style={{transform: `scale(${zoom})`, padding: '170px 90px 560px', justifyContent: 'center'}}>{children}</AbsoluteFill>
<div style={{position: 'absolute', top: 70, left: 90, right: 90, display: 'flex', justifyContent: 'space-between', fontSize: 30, fontWeight: 600, letterSpacing: 4, color: C.soft}}>
<span>{chap}</span>
<span>17.10.2026</span>
</div>
<div style={{position: 'absolute', inset: 0, background: accent, transform: `translateX(${wipe * 101}%)`}} />
</AbsoluteFill>
);
};
/** Sous-titres mot à mot : groupe de 3 mots au plus, mot prononcé surligné en jaune. */
const SousTitres: React.FC = () => {
const fr = useCurrentFrame();
for (let i = 0; i < PHRASES.length; i++) {
const ph = PHRASES[i];
const t = (fr - blocs[i].audioFrom) / FPS_EV2;
if (t < 0 || t > ph.dur + 0.15) continue;
let cur = ph.mots.findIndex(([, s, e]) => t >= s && t < e);
if (cur < 0) cur = ph.mots.reduce((a, [, s], k) => (t >= s ? k : a), 0);
const g0 = Math.floor(cur / 3) * 3;
const groupe = ph.mots.slice(g0, g0 + 3);
return (
<div style={{position: 'absolute', left: 70, right: 70, top: 1440, height: 260, borderTop: `3px solid ${C.ink}`, display: 'flex', alignItems: 'center', justifyContent: 'center', flexWrap: 'wrap', columnGap: 22, rowGap: 6}}>
{groupe.map(([w, s], k) => {
const on = g0 + k === cur;
const dit = t >= s;
return (
<span key={k} style={{fontSize: 68, fontWeight: 800, letterSpacing: -1, padding: '2px 10px', background: on ? C.jaune : 'transparent', color: dit ? C.ink : '#b5b5b5'}}>{w}</span>
);
})}
</div>
);
}
return null;
};
export const ExempleVoix2: React.FC = () => {
const fr = useCurrentFrame();
return (
<AbsoluteFill style={{background: C.bg, fontFamily, color: C.ink}}>
{blocs.map((b, i) => (
<React.Fragment key={i}>
{b.plans.map((p, j) => (
<Sequence key={j} from={p.from} durationInFrames={p.dur}>
<Shot dur={p.dur} accent={p.sub.accent} chap={p.sub.chap}>{p.sub.node}</Shot>
</Sequence>
))}
<Sequence from={b.audioFrom}>
<Audio src={staticFile(`voix-exemple2/${PHRASES[i].id}.wav`)} />
</Sequence>
</React.Fragment>
))}
{/* Emplacement musique : laissé vide (aucune musique à licence vérifiée pour l'instant).
<Audio src={staticFile('musique/xxx.mp3')} volume={0.12} /> */}
<SousTitres />
<div style={{position: 'absolute', left: 0, bottom: 0, height: 6, width: `${(fr / TOTAL_EV2) * 100}%`, background: C.ink}} />
</AbsoluteFill>
);
};
+2
Voir le fichier
@@ -5,6 +5,7 @@ import {JourneeTheoV2, TOTAL_V2, FPS_V2} from './JourneeTheoV2';
import {ActuViePrivee, TOTAL_AVP, FPS_AVP} from './ActuViePrivee';
import {NouveauteMind, TOTAL_NM, FPS_NM} from './NouveauteMind';
import {InvitationMind, TOTAL_IM, FPS_IM} from './InvitationMind';
import {ExempleVoix2, TOTAL_EV2, FPS_EV2} from './ExempleVoix2';
export const Root: React.FC = () => (
<>
@@ -13,5 +14,6 @@ export const Root: React.FC = () => (
<Composition id="NouveauteMind" component={NouveauteMind} durationInFrames={TOTAL_NM} fps={FPS_NM} width={1080} height={1920} />
<Composition id="ActuViePrivee" component={ActuViePrivee} durationInFrames={TOTAL_AVP} fps={FPS_AVP} width={1080} height={1920} />
<Composition id="InvitationMind" component={InvitationMind} durationInFrames={TOTAL_IM} fps={FPS_IM} width={1080} height={1920} />
<Composition id="ExempleVoix2" component={ExempleVoix2} durationInFrames={TOTAL_EV2} fps={FPS_EV2} width={1080} height={1920} />
</>
);
+381
Voir le fichier
@@ -0,0 +1,381 @@
// Généré depuis public/voix-exemple2/mots.json (horodatage faster-whisper, texte = script).
export type Phrase = {id: string; dur: number; mots: [string, number, number][]};
export const PHRASES: Phrase[] = [
{
"id": "p01",
"dur": 3.05,
"mots": [
[
"Sur",
0,
0.3
],
[
"Mind,",
0.3,
0.62
],
[
"la",
0.84,
1.02
],
[
"réponse",
1.02,
1.36
],
[
"s’affiche",
1.36,
1.82
],
[
"maintenant",
1.82,
2.2
],
[
"tout",
2.2,
2.42
],
[
"de",
2.42,
2.54
],
[
"suite.",
2.54,
2.8
]
]
},
{
"id": "p02",
"dur": 5.64,
"mots": [
[
"Avant,",
0,
0.76
],
[
"au",
1.08,
1.4
],
[
"premier",
1.4,
1.72
],
[
"message,",
1.72,
2.26
],
[
"elle",
2.66,
2.74
],
[
"attendait",
2.74,
3.12
],
[
"la",
3.12,
3.24
],
[
"fin",
3.24,
3.42
],
[
"d’une",
3.42,
3.62
],
[
"animation,",
3.62,
4.04
],
[
"plus",
4.36,
4.68
],
[
"d’une",
4.68,
4.92
],
[
"seconde.",
4.92,
5.44
]
]
},
{
"id": "p03",
"dur": 3.84,
"mots": [
[
"Alors",
0,
0.26
],
[
"qu’une",
0.26,
0.54
],
[
"réponse",
0.54,
0.94
],
[
"courte",
0.94,
1.4
],
[
"était",
1.4,
1.68
],
[
"souvent",
1.68,
2.02
],
[
"prête",
2.02,
2.46
],
[
"en",
2.46,
2.68
],
[
"une",
2.68,
2.86
],
[
"demi-seconde.",
2.86,
3.6
]
]
},
{
"id": "p04",
"dur": 4.33,
"mots": [
[
"Désormais,",
0,
0.58
],
[
"le",
0.82,
1.38
],
[
"texte",
1.38,
1.96
],
[
"apparaît",
1.96,
2.36
],
[
"pendant",
2.36,
2.58
],
[
"que",
2.58,
2.78
],
[
"le",
2.78,
2.92
],
[
"cadre",
2.92,
3.22
],
[
"se",
3.22,
3.66
],
[
"déroule.",
3.66,
4.08
]
]
},
{
"id": "p05",
"dur": 3.91,
"mots": [
[
"Autre",
0,
0.32
],
[
"détail,",
0.32,
0.74
],
[
"Mind",
1.4,
1.6
],
[
"connaît",
1.6,
2.24
],
[
"la",
2.24,
2.38
],
[
"date",
2.38,
2.66
],
[
"et",
2.66,
2.94
],
[
"l’heure",
2.94,
3.16
],
[
"de",
3.16,
3.32
],
[
"Paris.",
3.32,
3.66
]
]
},
{
"id": "p06",
"dur": 4.41,
"mots": [
[
"Et",
0,
0.32
],
[
"un",
0.32,
0.56
],
[
"outil",
0.56,
0.82
],
[
"météo,",
0.82,
1.3
],
[
"branché",
1.3,
1.82
],
[
"sur",
1.82,
2.04
],
[
"de",
2.04,
2.18
],
[
"vraies",
2.18,
2.48
],
[
"stations,",
2.48,
2.78
],
[
"est",
2.78,
3.38
],
[
"en",
3.38,
3.52
],
[
"préparation.",
3.52,
4.16
]
]
},
{
"id": "p07",
"dur": 3.87,
"mots": [
[
"Essaie-le",
0,
0.56
],
[
"sur",
0.56,
0.84
],
[
"mind.gastinel.me",
0.84,
3.62
]
]
}
];