Composition Remotion ArtCraft (theme sombre propre a cette video), voix provisoire dots.tts-soar, musique CC0 Pure Raceway calee sur 160 bpm, bruitages synthetises. Script et sources verifiees dans SCRIPT-artcraft-20261026.md. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
63 lignes
2.1 KiB
Python
63 lignes
2.1 KiB
Python
"""Synthétise les bruitages de la vidéo ArtCraft (écrit par Claude, 26/10/2026).
|
|
Sons créés ici avec numpy (aucun échantillon tiers, donc aucune licence à citer).
|
|
Usage : python -I outils-voix/sfx_artcraft.py -> public/sfx/{hit,pop,whoosh,tick,riser,ding}.wav
|
|
"""
|
|
import wave
|
|
from pathlib import Path
|
|
import numpy as np
|
|
|
|
SR = 48000
|
|
SORTIE = Path(__file__).resolve().parent.parent / "public/sfx"
|
|
SORTIE.mkdir(parents=True, exist_ok=True)
|
|
rng = np.random.default_rng(26)
|
|
|
|
|
|
def ecrire(nom, x, gain=0.9):
|
|
x = x / max(1e-9, np.max(np.abs(x))) * gain
|
|
with wave.open(str(SORTIE / f"{nom}.wav"), "wb") as w:
|
|
w.setnchannels(1); w.setsampwidth(2); w.setframerate(SR)
|
|
w.writeframes((x * 32767).astype(np.int16).tobytes())
|
|
|
|
|
|
def t(d): return np.arange(int(SR * d)) / SR
|
|
|
|
|
|
# hit : impact grave (sinus qui descend) + claque de bruit
|
|
x = t(0.35)
|
|
f = 150 * np.exp(-x * 14) + 45
|
|
corps = np.sin(2 * np.pi * np.cumsum(f) / SR) * np.exp(-x * 9)
|
|
claque = rng.standard_normal(len(x)) * np.exp(-x * 60) * 0.5
|
|
ecrire("hit", corps + claque)
|
|
|
|
# pop : petit blip aigu qui monte
|
|
x = t(0.16)
|
|
f = 500 + 1400 * (x / 0.16)
|
|
ecrire("pop", np.sin(2 * np.pi * np.cumsum(f) / SR) * np.exp(-x * 22))
|
|
|
|
# whoosh : bruit filtré qui balaie
|
|
x = t(0.5)
|
|
b = rng.standard_normal(len(x))
|
|
k = (np.sin(np.pi * x / 0.5)) ** 2
|
|
fc = 300 + 5200 * (x / 0.5)
|
|
y = np.zeros_like(b); a = 0.0
|
|
for i in range(len(b)): # filtre passe-bas à fréquence variable
|
|
c = min(0.99, 2 * np.pi * fc[i] / SR)
|
|
a += c * (b[i] - a); y[i] = a
|
|
ecrire("whoosh", y * k, 0.8)
|
|
|
|
# tick : clic sec pour les compteurs
|
|
x = t(0.04)
|
|
ecrire("tick", np.sin(2 * np.pi * 1800 * x) * np.exp(-x * 120), 0.6)
|
|
|
|
# riser : montée de bruit + sinus aigu (avant la révélation)
|
|
x = t(1.0)
|
|
b = rng.standard_normal(len(x)) * (x ** 2)
|
|
f = 200 + 1800 * x ** 2
|
|
ecrire("riser", b * 0.5 + np.sin(2 * np.pi * np.cumsum(f) / SR) * x ** 2, 0.8)
|
|
|
|
# ding : cloche courte (accord majeur) pour les victoires
|
|
x = t(0.9)
|
|
y = sum(np.sin(2 * np.pi * fr * x) * np.exp(-x * d) for fr, d in ((1046, 5), (1318, 5.5), (1568, 6)))
|
|
ecrire("ding", y, 0.7)
|
|
print("ok", sorted(p.name for p in SORTIE.iterdir()))
|