Fichiers
remotion-test/outils-voix/energie.py
T
Théo GastineletClaude Opus 5.5 9a20e84fad Video ecosysteme Gastinel : versions complete (71 s) et courte (42 s)
- Compositions EcosystemeComplet et EcosystemeCourt (src/Ecosysteme.tsx), reprend les composants de NouveauteMind et les sous-titres mot a mot d'ExempleVoix2
- Voix provisoire (dots.tts-soar) generee par le pipeline existant, decoupee et calee par outils-voix/preparer.py
- Captures reelles et publiques dans public/ecosysteme
- Script et rapport (sources de chaque affirmation, points a valider)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 21:00:57 +02:00

19 lignes
943 B
Python

"""Affiche le profil d'énergie (RMS par 100 ms) de chaque WAV d'un dossier, avec les bornes Whisper.
Usage : python energie.py <dossier contenant pNN.wav et mots.json>"""
import json, sys, wave
from pathlib import Path
import numpy as np
d = Path(sys.argv[1])
mots = json.loads((d / "mots.json").read_text(encoding="utf-8"))
for f in sorted(d.glob("p*.wav")):
with wave.open(str(f)) as w:
sr, n, sw = w.getframerate(), w.getnframes(), w.getsampwidth()
a = np.frombuffer(w.readframes(n), dtype=np.int16 if sw == 2 else np.int32).astype(np.float32)
a /= 32768.0 if sw == 2 else 2147483648.0
hop = sr // 10
rms = [float(np.sqrt(np.mean(a[i:i + hop] ** 2))) for i in range(0, len(a), hop)]
ligne = "".join(" " if r < 0.005 else "." if r < 0.02 else ":" if r < 0.06 else "#" for r in rms)
m = mots[f.stem]
print(f"{f.stem} {len(a)/sr:5.2f}s sw={sw} whisper {m[0][1]:.2f}-{m[-1][2]:.2f} |{ligne}|")